JCai commited on
Commit
8f7e33c
·
1 Parent(s): 8c14a90
Files changed (1) hide show
  1. app.py +11 -19
app.py CHANGED
@@ -194,6 +194,7 @@ ui_design = UI_design()
194
  with gr.Blocks(css=custom_css) as demo:
195
  gr.Markdown("<h1 style='text-align: center;'> 😸 Meowthamatical AI Chatbot 😸</h1>")
196
  gr.Markdown(" Interact with the AI chatbot using customizable settings below.")
 
197
 
198
  with gr.Row():
199
  with gr.Column():
@@ -204,31 +205,22 @@ with gr.Blocks(css=custom_css) as demo:
204
  input_text = gr.Textbox(label="input your question")
205
 
206
  with gr.Row():
207
- # with gr.Column():
208
- # clear_btn = gr.ClearButton(
209
- # [input_sketchpad, input_text])
210
  with gr.Column():
211
- submit_btn = gr.Button("Submit", variant="primary")
212
-
213
- with gr.Row():
214
- system_message = gr.Textbox(value= "You are a cat and you love talking about and teaching math.", label="System message", interactive=True)
215
- use_local_model = gr.Checkbox(label="Use Local Model", value=False)
216
- button_1 = gr.Button("Submit", variant="primary")
217
- with gr.Row():
218
- max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
219
- temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
220
- top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
221
-
222
- chat_history = gr.Chatbot(label="Chat")
223
 
224
- user_input = gr.Textbox(show_label=False, placeholder="Type your message here...")
225
 
226
- cancel_button = gr.Button("Cancel Inference", variant="danger")
227
 
228
  # Adjusted to ensure history is maintained and passed correctly
229
- user_input.submit(respond, [user_input, chat_history, system_message, max_tokens, temperature, top_p, use_local_model], chat_history)
230
 
231
- cancel_button.click(cancel_inference)
232
 
233
  if __name__ == "__main__":
234
  demo.launch(share=False) # Remove share=True because it's not supported on HF Spaces
 
194
  with gr.Blocks(css=custom_css) as demo:
195
  gr.Markdown("<h1 style='text-align: center;'> 😸 Meowthamatical AI Chatbot 😸</h1>")
196
  gr.Markdown(" Interact with the AI chatbot using customizable settings below.")
197
+ use_local_model = gr.Checkbox(label="Use Local Model", value=False)
198
 
199
  with gr.Row():
200
  with gr.Column():
 
205
  input_text = gr.Textbox(label="input your question")
206
 
207
  with gr.Row():
 
 
 
208
  with gr.Column():
209
+ clear_btn = gr.ClearButton(
210
+ [input_sketchpad, input_text])
211
+ with gr.Column():
212
+ submit_btn = gr.Button("Submit", variant="primary")
213
+ with gr.Column():
214
+ chat_history = gr.Chatbot(label="Chat")
 
 
 
 
 
 
215
 
216
+ user_input = gr.Textbox(show_label=False, placeholder="Type your message here...")
217
 
218
+ # cancel_button = gr.Button("Cancel Inference", variant="danger")
219
 
220
  # Adjusted to ensure history is maintained and passed correctly
221
+ user_input.submit(respond, [user_input, chat_history, use_local_model], chat_history)
222
 
223
+ # cancel_button.click(cancel_inference)
224
 
225
  if __name__ == "__main__":
226
  demo.launch(share=False) # Remove share=True because it's not supported on HF Spaces