hrsprojects commited on
Commit
cffbb06
·
verified ·
1 Parent(s): 42b1466

Upload 2 files

Browse files
Files changed (2) hide show
  1. app-2.py +21 -0
  2. deepseek-ai.py +16 -0
app-2.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import streamlit as st
4
+ import ast
5
+
6
+ # Mendapatkan isi script dari environment variable
7
+ script_repr = os.getenv("MY_SCRIPT_CONTENT")
8
+
9
+ if script_repr is None:
10
+ st.error("Environment variable 'MY_SCRIPT_CONTENT' not set.")
11
+ sys.exit(1)
12
+
13
+ # Mengevaluasi string literal dengan aman
14
+ try:
15
+ script_content = ast.literal_eval(script_repr)
16
+ except (ValueError, SyntaxError) as e:
17
+ st.error(f"Error evaluating script from environment variable: {e}")
18
+ sys.exit(1)
19
+
20
+ # Menjalankan script dinamis
21
+ exec(script_content)
deepseek-ai.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import spaces
3
+ import transformers_gradio
4
+
5
+ demo = gr.load(name="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B", src=transformers_gradio.registry)
6
+ demo = gr.load(name="deepseek-ai/DeepSeek-R1", src=transformers_gradio.registry)
7
+ demo = gr.load(name="deepseek-ai/DeepSeek-R1-Zero", src=transformers_gradio.registry)
8
+
9
+
10
+ demo.fn = spaces.GPU()(demo.fn)
11
+
12
+ for fn in demo.fns.values():
13
+ fn.api_name = False
14
+
15
+ if __name__ == "__main__":
16
+ demo.launch()