Spaces:
Build error
Build error
File size: 898 Bytes
1a1e7bf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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()
|