Hunyuan-Avatar / app.py
rahul7star's picture
Create app.py
1a1e7bf verified
raw
history blame
898 Bytes
import subprocess
import os
import gradio as gr
REPO_URL = "https://github.com/Tencent-Hunyuan/HunyuanVideo-Avatar.git" # replace with actual
CLONE_DIR = "."
def clone_repo():
if not os.path.exists(CLONE_DIR):
try:
subprocess.run(["git", "clone", REPO_URL, CLONE_DIR], check=True)
return "βœ… Repo cloned successfully."
except subprocess.CalledProcessError as e:
return f"❌ Error cloning repo: {e}"
else:
return "πŸ“ Repo already exists. Skipping clone."
# Run clone only once when the Space starts
clone_status = clone_repo()
print(clone_status)
# Optional: Import or run functions from the cloned repo
# e.g., sys.path.insert(0, CLONE_DIR) and import as needed
def greet(name):
return f"Hello, {name}! Repo clone status: {clone_status}"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()