SamAdel2000 commited on
Commit
3bfd444
·
verified ·
1 Parent(s): 96aa1a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -54
app.py CHANGED
@@ -2,59 +2,6 @@ import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  from g4f.gui import run_gui
4
 
5
- """
6
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
7
- """
8
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
9
-
10
-
11
- def respond(
12
- run_gui()
13
- ):
14
- messages = [{"role": "system", "content": system_message}]
15
-
16
- for val in history:
17
- if val[0]:
18
- messages.append({"role": "user", "content": val[0]})
19
- if val[1]:
20
- messages.append({"role": "assistant", "content": val[1]})
21
-
22
- messages.append({"role": "user", "content": message})
23
-
24
- response = ""
25
-
26
- for message in client.chat_completion(
27
- messages,
28
- max_tokens=max_tokens,
29
- stream=True,
30
- temperature=temperature,
31
- top_p=top_p,
32
- ):
33
- token = message.choices[0].delta.content
34
-
35
- response += token
36
- yield response
37
-
38
-
39
- """
40
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
41
- """
42
- demo = gr.ChatInterface(
43
- respond,
44
- additional_inputs=[
45
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
46
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
47
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
48
- gr.Slider(
49
- minimum=0.1,
50
- maximum=1.0,
51
- value=0.95,
52
- step=0.05,
53
- label="Top-p (nucleus sampling)",
54
- ),
55
- ],
56
- )
57
-
58
 
59
  if __name__ == "__main__":
60
- demo.launch()
 
2
  from huggingface_hub import InferenceClient
3
  from g4f.gui import run_gui
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  if __name__ == "__main__":
7
+ run_gui()