Download app.py from ewin-reg/DeepSeek-R1-Chat-Assistant-Web-Search: direct link, hf CLI and curl.
- Browser
- Download file 535 Bytes
-
https://huggingface.co/spaces/ewin-reg/DeepSeek-R1-Chat-Assistant-Web-Search/resolve/main/app.py
- Command line
-
hf download hf://spaces/ewin-reg/DeepSeek-R1-Chat-Assistant-Web-Search/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ewin-reg/DeepSeek-R1-Chat-Assistant-Web-Search/resolve/main/app.py
535 Bytes
| import os | |
| import sys | |
| import streamlit as st | |
| import ast | |
| # Mendapatkan isi script dari environment variable | |
| script_repr = os.getenv("MY_SCRIPT_CONTENT") | |
| if script_repr is None: | |
| st.error("Environment variable 'MY_SCRIPT_CONTENT' not set.") | |
| sys.exit(1) | |
| # Mengevaluasi string literal dengan aman | |
| try: | |
| script_content = ast.literal_eval(script_repr) | |
| except (ValueError, SyntaxError) as e: | |
| st.error(f"Error evaluating script from environment variable: {e}") | |
| sys.exit(1) | |
| # Menjalankan script dinamis | |
| exec(script_content) |