amitpandey8 commited on
Commit
3825247
·
verified ·
1 Parent(s): 4025aea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -1,12 +1,10 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
- """
5
- 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
6
- """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
-
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
@@ -39,13 +37,22 @@ def respond(
39
  response += token
40
  yield response
41
 
42
- """
43
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
- """
 
 
 
 
 
 
 
45
  demo = gr.ChatInterface(
46
  respond,
 
 
47
  additional_inputs=[
48
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
49
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
50
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
51
  gr.Slider(
@@ -56,8 +63,8 @@ demo = gr.ChatInterface(
56
  label="Top-p (nucleus sampling)",
57
  ),
58
  ],
 
59
  )
60
 
61
-
62
  if __name__ == "__main__":
63
  demo.launch()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
+ # Initialize the model and tokenizer
 
 
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
 
7
+ # Define the conversation flow
8
  def respond(
9
  message,
10
  history: list[tuple[str, str]],
 
37
  response += token
38
  yield response
39
 
40
+ # Create a custom theme for the chat interface
41
+ theme = gr.Theme(
42
+ primary_color="#3498db",
43
+ secondary_color="#f1c40f",
44
+ background_color="#f9f9f9",
45
+ text_color="#333",
46
+ font="Open Sans",
47
+ )
48
+
49
+ # Create the chat interface
50
  demo = gr.ChatInterface(
51
  respond,
52
+ title="NVS AI: Health Conversational Chatbot",
53
+ description="Get answers to your health-related questions!",
54
  additional_inputs=[
55
+ gr.Textbox(value="You are a friendly health chatbot.", label="System message"),
56
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
57
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
58
  gr.Slider(
 
63
  label="Top-p (nucleus sampling)",
64
  ),
65
  ],
66
+ theme=theme,
67
  )
68
 
 
69
  if __name__ == "__main__":
70
  demo.launch()