Pengi5659 commited on
Commit
88fc663
·
verified ·
1 Parent(s): ed50303

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -24
app.py CHANGED
@@ -1,11 +1,10 @@
1
-
2
-
3
  import gradio as gr
4
- import random as rd
5
- from huggingface_hub import InferenceClient
6
  from gradio.themes.base import Base
7
  import time
8
- client = InferenceClient("Qwen/Qwen2.5-72B-Instruct")
 
 
 
9
  seafoam = Seafoam()
10
 
11
  with gr.Blocks(theme=seafoam) as demo:
@@ -23,25 +22,9 @@ with gr.Blocks(theme=seafoam) as demo:
23
  button.click(repeat, [textbox, slider], output)
24
 
25
  demo.launch()
26
- def respond (message, history):
27
- messages = [{"role": "system", "content": "You are a chatbot who is sassy and doesnt explain an anser unless someone asks twice."}]
28
- if history:
29
- messages.extend(history)
30
- messages.append({"role": "user", "content": message})
31
- response = ""
32
- for message in client.chat_completion(
33
- messages,
34
- max_tokens=500,
35
- temperature=0.2,
36
- top_p=0.9,
37
- stream=True
38
- ):
39
- token = message.choices[0].delta.content
40
- response += token
41
- yield response
42
-
43
- chatbot = gr.ChatInterface(respond, type = "messages")
44
- chatbot.launch(debug=True)
45
 
46
 
47
 
 
 
 
1
  import gradio as gr
 
 
2
  from gradio.themes.base import Base
3
  import time
4
+
5
+ class Seafoam(Base):
6
+ pass
7
+
8
  seafoam = Seafoam()
9
 
10
  with gr.Blocks(theme=seafoam) as demo:
 
22
  button.click(repeat, [textbox, slider], output)
23
 
24
  demo.launch()
25
+
26
+
27
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
 
30