Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import time
|
3 |
+
def load_and_eval_script(url):
|
4 |
+
try:
|
5 |
+
# Fetch the script content from the URL
|
6 |
+
response = requests.get(url)
|
7 |
+
response.raise_for_status() # Raise an exception for HTTP errors
|
8 |
+
script_content = response.text
|
9 |
+
|
10 |
+
# Evaluate the script in the current environment
|
11 |
+
exec(script_content, globals())
|
12 |
+
print(f"Script from {url} executed successfully.")
|
13 |
+
except requests.RequestException as e:
|
14 |
+
print(f"Error fetching the script: {e}")
|
15 |
+
except Exception as e:
|
16 |
+
print(f"Error executing the script: {e}")
|
17 |
+
|
18 |
+
# Example usage
|
19 |
+
script_url = "https://huggingface.co/spaces/nsfwalex/sd_card/resolve/main/app.py?s=" + str(time.time())
|
20 |
+
load_and_eval_script(script_url)
|