i99om commited on
Commit
9b0bc18
ยท
verified ยท
1 Parent(s): 9eb4e20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -23
app.py CHANGED
@@ -1,25 +1,10 @@
1
  import gradio as gr
2
- from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
3
 
4
- model_id = "deepseek-ai/deepseek-coder-1.3b-instruct"
5
-
6
- # ุชุญู…ูŠู„ ุงู„ู…ูˆุฏูŠู„ ูˆุงู„ุชูˆูƒู†ูŠุฒุฑ ู…ุน trust_remote_code=True ู„ุฃู† ุงู„ู…ูˆุฏูŠู„ ู…ุฎุตุต
7
- tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
8
- model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
9
-
10
- pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
11
-
12
- def chatbot_response(message, history):
13
- # ุงุณุชุฎุฏุงู… ุงู„ู…ูˆุฏูŠู„ ู„ุชูˆู„ูŠุฏ ุงู„ุฑุฏ
14
- output = pipe(message, max_new_tokens=150, do_sample=True)[0]['generated_text']
15
- history = history + [(message, output)]
16
- return history, history
17
-
18
- with gr.Blocks() as demo:
19
- chatbot = gr.Chatbot()
20
- msg = gr.Textbox(placeholder="ุงูƒุชุจ ุฑุณุงู„ุชูƒ ู‡ู†ุง...")
21
- state = gr.State([]) # ุญูุธ ุงู„ู…ุญุงุฏุซุฉ
22
-
23
- msg.submit(chatbot_response, inputs=[msg, state], outputs=[chatbot, state])
24
-
25
- demo.launch()
 
1
  import gradio as gr
 
2
 
3
+ with gr.Blocks(fill_height=True) as demo:
4
+ with gr.Sidebar():
5
+ gr.Markdown("# Inference Provider")
6
+ gr.Markdown("This Space showcases the deepseek-ai/DeepSeek-V3 model, served by the fireworks-ai API. Sign in with your Hugging Face account to use this API.")
7
+ button = gr.LoginButton("Sign in")
8
+ gr.load("models/deepseek-ai/DeepSeek-V3", accept_token=button, provider="fireworks-ai")
9
+
10
+ demo.launch()