Spaces:
Sleeping
Sleeping
0.35 chatch exception
Browse files
app.py
CHANGED
@@ -190,32 +190,35 @@ arena_notes = """## Important Notes:
|
|
190 |
"""
|
191 |
|
192 |
with gr.Blocks() as demo:
|
193 |
-
|
194 |
-
gr.
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
with gr.
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
with gr.
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
219 |
|
220 |
if __name__ == "__main__":
|
221 |
demo.queue().launch()
|
|
|
190 |
"""
|
191 |
|
192 |
with gr.Blocks() as demo:
|
193 |
+
try:
|
194 |
+
with gr.Column():
|
195 |
+
gr.HTML("<center><h1>🤖le Royale</h1></center>")
|
196 |
+
gr.Markdown(arena_notes)
|
197 |
+
system_prompt = gr.Textbox(lines=1, label="System Prompt", value="You are a helpful chatbot that adheres to the prompted request.", show_copy_button=True)
|
198 |
+
with gr.Row(variant="panel"):
|
199 |
+
with gr.Column(scale=1):
|
200 |
+
submit_btn = gr.Button(value="Generate", variant="primary")
|
201 |
+
clear_btn = gr.Button(value="Clear", variant="secondary")
|
202 |
+
input_text = gr.Textbox(lines=1, label="Prompt", value="Write a Nike style ad headline about the shame of being second best.", scale=3, show_copy_button=True)
|
203 |
+
with gr.Row(variant="panel"):
|
204 |
+
with gr.Column():
|
205 |
+
chatbot_a = gr.Chatbot(label="Model A", show_copy_button=True, height=500)
|
206 |
+
with gr.Column():
|
207 |
+
chatbot_b = gr.Chatbot(label="Model B", show_copy_button=True, height=500)
|
208 |
+
with gr.Row(variant="panel"):
|
209 |
+
better_bot = gr.Radio(["Bot A kicks ass!", "Bot B crushes it!", "It's a draw."], label="Rate the output!"),
|
210 |
+
with gr.Accordion(label="Generation Configurations", open=False):
|
211 |
+
max_new_tokens = gr.Slider(minimum=128, maximum=4096, value=2048, label="Max New Tokens", step=128)
|
212 |
+
temperature = gr.Slider(minimum=0.0, maximum=1.0, value=0.7, label="Temperature", step=0.01)
|
213 |
+
top_p = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, label="Top-p", step=0.01)
|
214 |
+
repetition_penalty = gr.Slider(minimum=0.1, maximum=2.0, value=1.1, label="Repetition Penalty", step=0.1)
|
215 |
+
|
216 |
+
better_bot.select(reveal_bot, inputs=[better_bot, chatbot_a, chatbot_b], outputs=[chatbot_a, chatbot_b]) #fckp outputs=[chatbot_a, chatbot_b]
|
217 |
+
input_text.submit(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
|
218 |
+
submit_btn.click(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
|
219 |
+
clear_btn.click(clear, outputs=[chatbot_a, chatbot_b])
|
220 |
+
except Exception as e:
|
221 |
+
logging.error(f'{SPACER} Error: {e}, Traceback {traceback.format_exc()}')
|
222 |
|
223 |
if __name__ == "__main__":
|
224 |
demo.queue().launch()
|