yuchenlin commited on
Commit
5fbca7a
1 Parent(s): c9dcbb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -72,8 +72,11 @@ def respond(
72
  outputs.append(text)
73
  yield "".join(outputs)
74
 
 
 
75
  demo = gr.ChatInterface(
76
- respond,
 
77
  additional_inputs=[
78
  gr.Textbox(value="You are Magpie, a helpful AI assistant. For simple queries, try to answer them directly; for complex questions, try to think step-by-step before providing an answer.", label="System message"),
79
  gr.Slider(minimum=128, maximum=2048, value=512, step=64, label="Max new tokens"),
@@ -89,9 +92,17 @@ demo = gr.ChatInterface(
89
  ],
90
  description=header, # Add the header as the description
91
  title="MagpieLM-8B Chat (v0.1)",
92
- theme=gr.themes.Soft()
93
- )
 
 
 
 
 
 
 
 
94
 
95
  if __name__ == "__main__":
96
  demo.queue()
97
- demo.launch(share=True)
 
72
  outputs.append(text)
73
  yield "".join(outputs)
74
 
75
+ chatbot = gr.Chatbot(placeholder="<strong>MagpieLM-Chat-8B (v0.1)</strong>")
76
+
77
  demo = gr.ChatInterface(
78
+ fn=respond,
79
+ chatbot=chatbot,
80
  additional_inputs=[
81
  gr.Textbox(value="You are Magpie, a helpful AI assistant. For simple queries, try to answer them directly; for complex questions, try to think step-by-step before providing an answer.", label="System message"),
82
  gr.Slider(minimum=128, maximum=2048, value=512, step=64, label="Max new tokens"),
 
92
  ],
93
  description=header, # Add the header as the description
94
  title="MagpieLM-8B Chat (v0.1)",
95
+ theme=gr.themes.Soft(),
96
+ examples=[
97
+ ["Hello, what is your name?"],
98
+ ["Can you write a poem for me?"],
99
+ ["What's the meaning of life?"],
100
+ ]
101
+ )
102
+
103
+ # set a default message in the chatbox to start the conversation
104
+ # demo.chatbot.placeholder = "Hello! What's your name?"
105
 
106
  if __name__ == "__main__":
107
  demo.queue()
108
+ demo.launch(share=True, show_api=False)