Spaces:
Build error
Build error
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() | |