Spaces:
Running
Running
Create models1.py
Browse files- models1.py +22 -0
models1.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# models.py
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
import spaces
|
5 |
+
import types
|
6 |
+
|
7 |
+
# Create a local "transformers_gradio" object to mimic the missing package
|
8 |
+
transformers_gradio = types.SimpleNamespace(registry="huggingface")
|
9 |
+
|
10 |
+
# Now the gradio.load calls will work as if we had `import transformers_gradio`
|
11 |
+
demo = gr.load(name="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B", src=transformers_gradio.registry)
|
12 |
+
demo = gr.load(name="deepseek-ai/DeepSeek-R1", src=transformers_gradio.registry)
|
13 |
+
demo = gr.load(name="deepseek-ai/DeepSeek-R1-Zero", src=transformers_gradio.registry)
|
14 |
+
|
15 |
+
# Example of using spaces (assuming `spaces.GPU()` is valid in your environment)
|
16 |
+
demo.fn = spaces.GPU()(demo.fn)
|
17 |
+
|
18 |
+
for fn in demo.fns.values():
|
19 |
+
fn.api_name = False
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
demo.launch()
|