Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
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 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|