rwitz commited on
Commit
9440aa6
·
verified ·
1 Parent(s): 29ce4b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -275,17 +275,18 @@ with gr.Blocks() as demo:
275
  with gr.Row():
276
  character_name = gr.Textbox(label="Character Name",value="Ryan", placeholder="Enter character name (max 20 chars)", max_lines=1)
277
  character_description = gr.Textbox(label="Character Description",value="Ryan is a college student who is always willing to help. He knows a lot about math and coding.", placeholder="Enter character description (max 200 chars)", max_lines=5)
278
-
 
279
 
280
  # ...
281
 
282
  reset_btn.click(clear_chat, inputs=[state], outputs=[state, chatbot1, chatbot2, upvote_btn_a, upvote_btn_b, textbox, submit_btn])
283
- submit_btn.click(user_ask, inputs=[state, chatbot1, chatbot2, textbox, character_name, character_description], outputs=[state, chatbot1, chatbot2, textbox, upvote_btn_a, upvote_btn_b], queue=True)
 
284
  collection = init_database()
285
 
286
  upvote_btn_a.click(vote_up_model, inputs=[state, chatbot1, chatbot2], outputs=[chatbot1, chatbot2, upvote_btn_a, upvote_btn_b, textbox, submit_btn])
287
  upvote_btn_b.click(vote_down_model, inputs=[state, chatbot1, chatbot2], outputs=[chatbot1, chatbot2, upvote_btn_a, upvote_btn_b, textbox, submit_btn])
288
- textbox.submit(user_ask, inputs=[state, chatbot1, chatbot2, textbox], outputs=[state, chatbot1, chatbot2, textbox, upvote_btn_a, upvote_btn_b], queue=True)
289
 
290
  with gr.Tab("💬 Direct Chat"):
291
  gr.Markdown("## 🗣️ Chat directly with a model!")
 
275
  with gr.Row():
276
  character_name = gr.Textbox(label="Character Name",value="Ryan", placeholder="Enter character name (max 20 chars)", max_lines=1)
277
  character_description = gr.Textbox(label="Character Description",value="Ryan is a college student who is always willing to help. He knows a lot about math and coding.", placeholder="Enter character description (max 200 chars)", max_lines=5)
278
+ with gr.Row():
279
+ user_name = gr.Textbox(label="Your Name",value="You", placeholder="Enter your name", max_lines=1)
280
 
281
  # ...
282
 
283
  reset_btn.click(clear_chat, inputs=[state], outputs=[state, chatbot1, chatbot2, upvote_btn_a, upvote_btn_b, textbox, submit_btn])
284
+ submit_btn.click(user_ask, inputs=[state, chatbot1, chatbot2, textbox, character_name, character_description, user_name], outputs=[state, chatbot1, chatbot2, textbox, upvote_btn_a, upvote_btn_b], queue=True)
285
+ textbox.submit(user_ask, inputs=[state, chatbot1, chatbot2, textbox, character_name, character_description, user_name], outputs=[state, chatbot1, chatbot2, textbox, upvote_btn_a, upvote_btn_b], queue=True)
286
  collection = init_database()
287
 
288
  upvote_btn_a.click(vote_up_model, inputs=[state, chatbot1, chatbot2], outputs=[chatbot1, chatbot2, upvote_btn_a, upvote_btn_b, textbox, submit_btn])
289
  upvote_btn_b.click(vote_down_model, inputs=[state, chatbot1, chatbot2], outputs=[chatbot1, chatbot2, upvote_btn_a, upvote_btn_b, textbox, submit_btn])
 
290
 
291
  with gr.Tab("💬 Direct Chat"):
292
  gr.Markdown("## 🗣️ Chat directly with a model!")