Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -1,22 +1,25 @@
|
|
1 |
import subprocess
|
|
|
|
|
2 |
|
|
|
3 |
subprocess.call(["pip", "install", "flet==0.19.0"])
|
4 |
subprocess.call(["pip", "install", "flet_fastapi==0.19.0"])
|
5 |
|
6 |
-
|
7 |
-
import time
|
8 |
-
|
9 |
gh_token = os.getenv("gh_token")
|
10 |
|
11 |
-
|
|
|
12 |
|
|
|
13 |
os.system(f"git clone {url_with_token}")
|
14 |
-
|
15 |
-
time.sleep(10)
|
16 |
|
17 |
-
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
|
|
|
1 |
import subprocess
|
2 |
+
import os
|
3 |
+
import time
|
4 |
|
5 |
+
# Install required packages
|
6 |
subprocess.call(["pip", "install", "flet==0.19.0"])
|
7 |
subprocess.call(["pip", "install", "flet_fastapi==0.19.0"])
|
8 |
|
9 |
+
# Get GitHub token from environment variable
|
|
|
|
|
10 |
gh_token = os.getenv("gh_token")
|
11 |
|
12 |
+
# Construct GitHub URL with token for cloning
|
13 |
+
url_with_token = f"https://{gh_token}@github.com/Eslam-Magdy-1297/ESearch_FletV01.git"
|
14 |
|
15 |
+
# Clone the repository
|
16 |
os.system(f"git clone {url_with_token}")
|
|
|
|
|
17 |
|
18 |
+
# Wait for cloning to complete
|
19 |
+
time.sleep(10)
|
20 |
|
21 |
+
# Copy main.py to current directory, replacing existing files
|
22 |
+
os.system("cp -f ESearch_FletV01/main.py ./")
|
23 |
|
24 |
+
# Optionally, you may want to execute the main.py file here
|
25 |
+
os.system("python main.py")
|