huohguohbo commited on
Commit
3fb3843
·
1 Parent(s): 3692c73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -30
app.py CHANGED
@@ -116,9 +116,8 @@ hf_chat_button = gr.Interface(
116
  )
117
 
118
  chat_button = gr.Interface(
119
- inputs="text",
120
- outputs=["text", "text"],
121
- layout="vertical",
122
  title="Chatbot",
123
  description="Enter your message below to chat with an AI",
124
  theme="compact",
@@ -126,34 +125,11 @@ chat_button = gr.Interface(
126
  allow_screenshot=False,
127
  allow_share=False,
128
  examples=[
129
- ["Hello, how are you?", ""],
130
- ["What's the weather like today?", ""],
131
- ["Can you help me with some Python code?", "```python\nfor i in range(10):\n print(i)\n```"],
132
  ],
 
133
  )
134
 
135
- chat_button.set_config(gr.InterfaceConfig(
136
- dependencies=["transformers"],
137
- inputs=[gr.InterfaceComponent(model_input, label="OpenAI Model", visible=False)],
138
- outputs=[gr.InterfaceComponent(output, label="Bot Response"), gr.InterfaceComponent(api_key_input, label="OpenAI API Key", visible=False)],
139
- layout="vertical",
140
- title="OpenAI Chatbot (API Key Required)",
141
- ))
142
-
143
- chat_button.set_config(gr.InterfaceConfig(
144
- dependencies=["transformers"],
145
- inputs=[gr.InterfaceComponent(hf_model_input, label="Hugging Face Model", visible=False)],
146
- outputs=[gr.InterfaceComponent(output, label="Bot Response")],
147
- layout="vertical",
148
- title="Hugging Face Chatbot",
149
- ))
150
-
151
- chat_button.set_config(gr.InterfaceConfig(
152
- dependencies=["transformers"],
153
- inputs=[gr.InterfaceComponent(model_input, label="OpenAI Model"), gr.InterfaceComponent(hf_model_input, label="Hugging Face Model", visible=False)],
154
- outputs=[gr.InterfaceComponent(output, label="Bot Response"), gr.InterfaceComponent(api_key_input, label="OpenAI API Key")],
155
- layout="vertical",
156
- title="Chatbot",
157
- ))
158
-
159
  chat_button.test_launch() # Launch the Gradio interface
 
116
  )
117
 
118
  chat_button = gr.Interface(
119
+ inputs=[message_input, model_input, hf_model_input, api_key_input],
120
+ outputs=output,
 
121
  title="Chatbot",
122
  description="Enter your message below to chat with an AI",
123
  theme="compact",
 
125
  allow_screenshot=False,
126
  allow_share=False,
127
  examples=[
128
+ ["Hello, how are you?", "", "", None],
129
+ ["What's the weather like today?", "", "", None],
130
+ ["Can you help me with some Python code?", "```python\nfor i in range(10):\n print(i)\n```", "", None],
131
  ],
132
+ live=False,
133
  )
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  chat_button.test_launch() # Launch the Gradio interface