Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,16 @@
|
|
1 |
import os
|
2 |
import requests
|
3 |
|
4 |
-
# Fetching environment variables
|
5 |
github_pat = os.environ['github_pat']
|
6 |
-
repo_url = os.environ['repo_url']
|
7 |
|
8 |
-
|
9 |
-
file_path = 'run.py' # Adjust the path according to your repository structure
|
10 |
-
raw_url = f'https://raw.githubusercontent.com/{repo_url}/{file_path}'
|
11 |
|
12 |
-
|
13 |
-
headers = {'Authorization': f'token {github_pat}'}
|
14 |
-
|
15 |
-
# Fetching the file content from the repository
|
16 |
-
response = requests.get(raw_url, headers=headers)
|
17 |
if response.status_code == 200:
|
18 |
-
# Dynamically execute the fetched Python code
|
19 |
exec(response.text)
|
20 |
else:
|
21 |
-
raise Exception("Failed to fetch the Python file from the repository")
|
22 |
|
23 |
-
# Now you can use Anonimiseren class as if it was locally defined
|
24 |
anonymizer = Anonimiseren()
|
25 |
|
26 |
print(anonymizer)
|
|
|
1 |
import os
|
2 |
import requests
|
3 |
|
|
|
4 |
github_pat = os.environ['github_pat']
|
|
|
5 |
|
6 |
+
raw_url = f'https://{github_pat}@raw.githubusercontent.com/waaljair/testgradio/main/run.py'
|
|
|
|
|
7 |
|
8 |
+
response = requests.get(raw_url)
|
|
|
|
|
|
|
|
|
9 |
if response.status_code == 200:
|
|
|
10 |
exec(response.text)
|
11 |
else:
|
12 |
+
raise Exception(f"Failed to fetch the Python file from the repository. Status code: {response.status_code}")
|
13 |
|
|
|
14 |
anonymizer = Anonimiseren()
|
15 |
|
16 |
print(anonymizer)
|