Spaces:
Running
Running
Update src/app.py
Browse files- src/app.py +5 -1
src/app.py
CHANGED
@@ -22,14 +22,18 @@ def execute_remote_script(url: str): # code_str: str
|
|
22 |
|
23 |
# Get the script content as a string
|
24 |
code_string = response.text
|
25 |
-
st.write(code_string)
|
26 |
|
27 |
# Create a fresh module namespace to execute the code in
|
28 |
dynamic_module = types.ModuleType("dynamic_module")
|
|
|
29 |
st.write(dynamic_module)
|
30 |
|
31 |
# Execute the code string in the new namespace
|
32 |
exec(code_string, dynamic_module.__dict__)
|
|
|
|
|
|
|
33 |
|
34 |
except requests.exceptions.RequestException as e:
|
35 |
st.error(f"Error downloading the script: {e}")
|
|
|
22 |
|
23 |
# Get the script content as a string
|
24 |
code_string = response.text
|
25 |
+
# st.write(code_string)
|
26 |
|
27 |
# Create a fresh module namespace to execute the code in
|
28 |
dynamic_module = types.ModuleType("dynamic_module")
|
29 |
+
st.write('Here:')
|
30 |
st.write(dynamic_module)
|
31 |
|
32 |
# Execute the code string in the new namespace
|
33 |
exec(code_string, dynamic_module.__dict__)
|
34 |
+
st.write('DONE')
|
35 |
+
if hasattr(module,"main"):
|
36 |
+
module.main()
|
37 |
|
38 |
except requests.exceptions.RequestException as e:
|
39 |
st.error(f"Error downloading the script: {e}")
|