ajsbsd commited on
Commit
be81ee8
·
verified ·
1 Parent(s): 9de95a1
Files changed (1) hide show
  1. app.py +19 -20
app.py CHANGED
@@ -4,9 +4,8 @@ from huggingface_hub import InferenceClient
4
  import os
5
  token = os.getenv("HF_TOKEN")
6
 
7
-
8
  """
9
- 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
10
  """
11
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=token)
12
 
@@ -45,25 +44,25 @@ def respond(
45
 
46
 
47
  """
48
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
49
  """
50
 
51
- with gr.Blocks(theme=gr.themes.Soft()) as demo = gr.ChatInterface(
52
- respond,
53
- additional_inputs=[
54
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
55
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
56
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
57
- gr.Slider(
58
- minimum=0.1,
59
- maximum=1.0,
60
- value=0.95,
61
- step=0.05,
62
- label="Top-p (nucleus sampling)",
63
- ),
64
- ],
65
- )
66
-
67
 
68
  if __name__ == "__main__":
69
- demo.launch()
 
4
  import os
5
  token = os.getenv("HF_TOKEN")
6
 
 
7
  """
8
+ 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
9
  """
10
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=token)
11
 
 
44
 
45
 
46
  """
47
+ For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
48
  """
49
 
50
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
51
+ chat_interface = gr.ChatInterface(
52
+ fn=respond,
53
+ additional_inputs=[
54
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
55
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
56
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
57
+ gr.Slider(
58
+ minimum=0.1,
59
+ maximum=1.0,
60
+ value=0.95,
61
+ step=0.05,
62
+ label="Top-p (nucleus sampling)",
63
+ ),
64
+ ],
65
+ )
66
 
67
  if __name__ == "__main__":
68
+ demo.launch()