Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
import spaces
|
3 |
-
import transformers_gradio
|
4 |
from functools import lru_cache
|
5 |
|
6 |
# Cache model loading to optimize performance
|
7 |
@lru_cache(maxsize=3)
|
8 |
def load_hf_model(model_name):
|
|
|
9 |
return gr.load(
|
10 |
name=f"deepseek-ai/{model_name}",
|
11 |
-
src=transformers_gradio.registry
|
12 |
api_name="/chat"
|
13 |
)
|
14 |
|
@@ -51,7 +51,6 @@ with gr.Blocks(theme=gr.themes.Soft(), title="DeepSeek Chatbot") as demo:
|
|
51 |
"""
|
52 |
# DeepSeek Chatbot
|
53 |
Created by [ruslanmv.com](https://ruslanmv.com/)
|
54 |
-
|
55 |
This is a demo of different DeepSeek models. Select a model, type your message, and click "Submit".
|
56 |
You can also adjust optional parameters like system message, max new tokens, temperature, and top-p.
|
57 |
"""
|
@@ -104,8 +103,8 @@ with gr.Blocks(theme=gr.themes.Soft(), title="DeepSeek Chatbot") as demo:
|
|
104 |
|
105 |
# Add GPU support for Hugging Face Spaces
|
106 |
demo.fn = spaces.GPU()(demo.fn)
|
107 |
-
for fn in demo.fns.values():
|
108 |
fn.api_name = False
|
109 |
|
110 |
if __name__ == "__main__":
|
111 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import spaces
|
|
|
3 |
from functools import lru_cache
|
4 |
|
5 |
# Cache model loading to optimize performance
|
6 |
@lru_cache(maxsize=3)
|
7 |
def load_hf_model(model_name):
|
8 |
+
# Use the Gradio-built huggingface loader instead of transformers_gradio
|
9 |
return gr.load(
|
10 |
name=f"deepseek-ai/{model_name}",
|
11 |
+
src="huggingface", # Changed from transformers_gradio.registry
|
12 |
api_name="/chat"
|
13 |
)
|
14 |
|
|
|
51 |
"""
|
52 |
# DeepSeek Chatbot
|
53 |
Created by [ruslanmv.com](https://ruslanmv.com/)
|
|
|
54 |
This is a demo of different DeepSeek models. Select a model, type your message, and click "Submit".
|
55 |
You can also adjust optional parameters like system message, max new tokens, temperature, and top-p.
|
56 |
"""
|
|
|
103 |
|
104 |
# Add GPU support for Hugging Face Spaces
|
105 |
demo.fn = spaces.GPU()(demo.fn)
|
106 |
+
for fn in demo.fns.values():
|
107 |
fn.api_name = False
|
108 |
|
109 |
if __name__ == "__main__":
|
110 |
+
demo.launch()
|