Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ app = Flask(__name__)
|
|
11 |
# Use /tmp directory for storing the model
|
12 |
MODEL_DIR = "/tmp/model"
|
13 |
MODEL_PATH = os.path.join(MODEL_DIR, "calme-3.3-llamaloi-3b.Q4_K_M.gguf")
|
14 |
-
GH_PAT =
|
15 |
REPO_URL = "https://github.com/NitinBot001/Audio-url-new-js.git"
|
16 |
|
17 |
def download_model():
|
@@ -55,18 +55,21 @@ def push_tunnel_url_to_repo(tunnel_url):
|
|
55 |
json.dump(instance_data, f)
|
56 |
|
57 |
# Clone the repository
|
|
|
58 |
subprocess.run(
|
59 |
-
["git", "clone", f"https://x-access-token:{GH_PAT}@{REPO_URL.split('https://')[1]}",
|
60 |
check=True,
|
61 |
)
|
62 |
-
os.chdir(
|
63 |
|
64 |
# Move instance.json to the repository
|
65 |
subprocess.run(["mv", "/tmp/instance.json", "."], check=True)
|
66 |
|
|
|
|
|
|
|
|
|
67 |
# Commit and push changes
|
68 |
-
subprocess.run(["git", "config", "--global", "user.email", "[email protected]"], check=True)
|
69 |
-
subprocess.run(["git", "config", "--global", "user.name", "github-actions"], check=True)
|
70 |
subprocess.run(["git", "add", "instance.json"], check=True)
|
71 |
subprocess.run(["git", "commit", "-m", f"Update tunnel URL to {tunnel_url}"], check=True)
|
72 |
subprocess.run(["git", "push", "origin", "main"], check=True)
|
|
|
11 |
# Use /tmp directory for storing the model
|
12 |
MODEL_DIR = "/tmp/model"
|
13 |
MODEL_PATH = os.path.join(MODEL_DIR, "calme-3.3-llamaloi-3b.Q4_K_M.gguf")
|
14 |
+
GH_PAT = "ghp_TGVMURDWG3HkLIfWUa4hyJUGYOYgXH1EljIi" # GitHub Personal Access Token
|
15 |
REPO_URL = "https://github.com/NitinBot001/Audio-url-new-js.git"
|
16 |
|
17 |
def download_model():
|
|
|
55 |
json.dump(instance_data, f)
|
56 |
|
57 |
# Clone the repository
|
58 |
+
repo_dir = "/tmp/repo"
|
59 |
subprocess.run(
|
60 |
+
["git", "clone", f"https://x-access-token:{GH_PAT}@{REPO_URL.split('https://')[1]}", repo_dir],
|
61 |
check=True,
|
62 |
)
|
63 |
+
os.chdir(repo_dir)
|
64 |
|
65 |
# Move instance.json to the repository
|
66 |
subprocess.run(["mv", "/tmp/instance.json", "."], check=True)
|
67 |
|
68 |
+
# Configure Git locally (without --global)
|
69 |
+
subprocess.run(["git", "config", "user.email", "[email protected]"], check=True)
|
70 |
+
subprocess.run(["git", "config", "user.name", "github-actions"], check=True)
|
71 |
+
|
72 |
# Commit and push changes
|
|
|
|
|
73 |
subprocess.run(["git", "add", "instance.json"], check=True)
|
74 |
subprocess.run(["git", "commit", "-m", f"Update tunnel URL to {tunnel_url}"], check=True)
|
75 |
subprocess.run(["git", "push", "origin", "main"], check=True)
|