rwitz commited on
Commit
85c68a8
Β·
1 Parent(s): 405fa0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -13
app.py CHANGED
@@ -101,20 +101,30 @@ def user_ask(state, chatbot1, chatbot2, textbox):
101
 
102
  with gr.Blocks() as demo:
103
  with gr.Row():
104
- with gr.Column(scale=0.5):
105
- with gr.Row() as button_row:
106
- upvote_btn = gr.Button(value="<= Vote for A", interactive=False)
107
- downvote_btn = gr.Button(value="=> Vote for B", interactive=False)
108
- tie_btn = gr.Button(value="🀝 Tie", interactive=False)
109
- clear_btn = gr.Button(value="πŸ—‘οΈ Clear", interactive=False)
110
  with gr.Column():
111
  chatbot1 = gr.Chatbot(label='Model A')
 
 
 
 
 
112
  chatbot2 = gr.Chatbot(label='Model B')
113
  with gr.Row():
114
- with gr.Column(scale=8):
115
- textbox = gr.Textbox(placeholder="Enter your prompt and press ENTER")
116
- with gr.Column(scale=1, min_width=60):
117
- submit_btn = gr.Button(value="Send")
118
-
119
-
120
- demo.launch(share=True, server_name='0.0.0.0', server_port=7860)
 
 
 
 
 
 
 
 
 
 
 
101
 
102
  with gr.Blocks() as demo:
103
  with gr.Row():
104
+ # First column for Model A
 
 
 
 
 
105
  with gr.Column():
106
  chatbot1 = gr.Chatbot(label='Model A')
107
+ with gr.Row():
108
+ upvote_btn_a = gr.Button(value="πŸ‘ Upvote A", interactive=False)
109
+
110
+ # Second column for Model B
111
+ with gr.Column():
112
  chatbot2 = gr.Chatbot(label='Model B')
113
  with gr.Row():
114
+ upvote_btn_b = gr.Button(value="πŸ‘ Upvote B", interactive=False)
115
+ tie_btn_b = gr.Button(value="🀝 Tie", interactive=False)
116
+
117
+ # Textbox and submit button at the bottom
118
+ with gr.Row():
119
+ textbox = gr.Textbox(placeholder="Enter your prompt and press ENTER")
120
+ submit_btn = gr.Button(value="Send")
121
+
122
+ # Interaction logic
123
+ textbox.submit(user_ask, [state, chatbot1, chatbot2, textbox], [state, chatbot1, chatbot2, textbox])
124
+ submit_btn.click(user_ask, [state, chatbot1, chatbot2, textbox], [state, chatbot1, chatbot2, textbox])
125
+ upvote_btn_a.click(vote_up_model, [state, chatbot1], [chatbot1])
126
+ upvote_btn_b.click(vote_up_model, [state, chatbot2], [chatbot2])
127
+
128
+ # Start the interface
129
+ demo.queue()
130
+ demo.launch()