File size: 1,265 Bytes
2c4c7b5
9c07ccc
0b10a3a
9c07ccc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2c4c7b5
 
9c07ccc
 
2c4c7b5
9c07ccc
 
 
2c4c7b5
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import gradio as gr
import spaces
import transformers
# Load *only* your model's interface. 
# 
# The original snippet loaded three models:
#   demo = gr.load(name="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B", src=transformers_gradio.registry)
#   demo = gr.load(name="deepseek-ai/DeepSeek-R1", src=transformers_gradio.registry)
#   demo = gr.load(name="deepseek-ai/DeepSeek-R1-Zero", src=transformers_gradio.registry)
#
# But we want the same UI, using *your* model from Hugging Face. So we do a single gr.load(...) call:
# 
# IMPORTANT:
#   1) "name" should be the exact repository you want to load. 
#   2) If your UI code was stored as a "Space" with a 'app.py' or 'api' in your "wuhp/myr1" repo, 
#      this approach should pull that same Gradio interface. 
#   3) If "transformers_gradio.registry" is correct for your space, keep it. 
#      Otherwise, you might need "src='spaces'" or a different source, depending on how your space is set up.

demo = gr.load(
    name="wuhp/myr1", 
    src="transformers_gradio.registry"
)

# If you want GPU usage (like the original snippet):
demo.fn = spaces.GPU()(demo.fn)

# Remove API names (like the original snippet):
for fn in demo.fns.values():
    fn.api_name = False

if __name__ == "__main__":
    demo.launch()