rahul7star commited on
Commit
1a1e7bf
·
verified ·
1 Parent(s): 6aa1788

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import os
3
+ import gradio as gr
4
+
5
+ REPO_URL = "https://github.com/Tencent-Hunyuan/HunyuanVideo-Avatar.git" # replace with actual
6
+ CLONE_DIR = "."
7
+
8
+ def clone_repo():
9
+ if not os.path.exists(CLONE_DIR):
10
+ try:
11
+ subprocess.run(["git", "clone", REPO_URL, CLONE_DIR], check=True)
12
+ return "✅ Repo cloned successfully."
13
+ except subprocess.CalledProcessError as e:
14
+ return f"❌ Error cloning repo: {e}"
15
+ else:
16
+ return "📁 Repo already exists. Skipping clone."
17
+
18
+ # Run clone only once when the Space starts
19
+ clone_status = clone_repo()
20
+ print(clone_status)
21
+
22
+ # Optional: Import or run functions from the cloned repo
23
+ # e.g., sys.path.insert(0, CLONE_DIR) and import as needed
24
+
25
+ def greet(name):
26
+ return f"Hello, {name}! Repo clone status: {clone_status}"
27
+
28
+ iface = gr.Interface(fn=greet, inputs="text", outputs="text")
29
+ iface.launch()