Spaces:
Sleeping
Sleeping
0.52 UI improvements
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ system_prompts = {
|
|
24 |
"Spanish": "Eres un chatbot servicial que responde a las entradas de los usuarios de forma concisa y original."
|
25 |
}
|
26 |
|
27 |
-
htmL_info = "<center><h1>⚔️ Pharia Bot Battle Royale</h1><p>Let the games begin: In this arena, the Pharia 1 model competes against a random challenger. Try a prompt in a language you want to explore. Set the parameters and vote for the best answers. After casting your vote,
|
28 |
|
29 |
model_info = [{"id": "Aleph-Alpha/Pharia-1-LLM-7B-control-hf",
|
30 |
"name": "Pharia 1 LLM 7B control hf"}]
|
@@ -108,7 +108,7 @@ def generate_both(system_prompt, input_text, chatbot_a, chatbot_b, max_new_token
|
|
108 |
new_messages_b = system_prompt_list + chat_history_b + input_text_list
|
109 |
|
110 |
logging.debug(f'{SPACER}\nNew message bot A: \n{new_messages_a}\n{SPACER}')
|
111 |
-
logging.debug(f'{SPACER}\
|
112 |
|
113 |
if "Pharia" in model_info[0]['id']:
|
114 |
formatted_conversation = apply_pharia_template(messages=new_messages_a, add_generation_prompt=True)
|
@@ -227,6 +227,7 @@ with gr.Blocks() as demo:
|
|
227 |
try:
|
228 |
with gr.Column():
|
229 |
gr.HTML(htmL_info)
|
|
|
230 |
with gr.Row(variant="compact"):
|
231 |
with gr.Column(scale=0):
|
232 |
language_dropdown = gr.Dropdown(
|
@@ -241,6 +242,12 @@ with gr.Blocks() as demo:
|
|
241 |
value=system_prompts["English"],
|
242 |
show_copy_button=True
|
243 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
with gr.Row(variant="panel"):
|
245 |
with gr.Column(scale=1):
|
246 |
submit_btn = gr.Button(value="Generate", variant="primary")
|
@@ -253,12 +260,6 @@ with gr.Blocks() as demo:
|
|
253 |
chatbot_b = gr.Chatbot(label="Model B", show_copy_button=True, height=500)
|
254 |
with gr.Row(variant="panel"):
|
255 |
better_bot = gr.Radio(["Bot A kicks ass!", "Bot B crushes it!", "It's a draw."], label="Rate the output!")
|
256 |
-
with gr.Accordion(label="Generation Configurations", open=False):
|
257 |
-
max_new_tokens = gr.Slider(minimum=128, maximum=4096, value=512, label="Max new tokens", step=128)
|
258 |
-
temperature = gr.Slider(minimum=0.0, maximum=1.0, value=0.7, label="Temperature", step=0.01)
|
259 |
-
top_p = gr.Slider(minimum=0.0, maximum=1.0, value=0.97, label="Top_p", step=0.01)
|
260 |
-
repetition_penalty = gr.Slider(minimum=0.1, maximum=2.0, value=1.1, label="Repetition Penalty", step=0.1)
|
261 |
-
|
262 |
|
263 |
language_dropdown.change(
|
264 |
lambda lang: system_prompts[lang],
|
|
|
24 |
"Spanish": "Eres un chatbot servicial que responde a las entradas de los usuarios de forma concisa y original."
|
25 |
}
|
26 |
|
27 |
+
htmL_info = "<center><h1>⚔️ Pharia Bot Battle Royale</h1><p>Let the games begin: In this arena, the Pharia 1 model competes against a random challenger. Try a prompt in a language you want to explore. Set the parameters and vote for the best answers. After casting your vote, both bots reveal their identity. Inputs, outputs and votes are logged anonymously.</p></center>"
|
28 |
|
29 |
model_info = [{"id": "Aleph-Alpha/Pharia-1-LLM-7B-control-hf",
|
30 |
"name": "Pharia 1 LLM 7B control hf"}]
|
|
|
108 |
new_messages_b = system_prompt_list + chat_history_b + input_text_list
|
109 |
|
110 |
logging.debug(f'{SPACER}\nNew message bot A: \n{new_messages_a}\n{SPACER}')
|
111 |
+
logging.debug(f'{SPACER}\nNew message bot B: \n{new_messages_b}\n{SPACER}')
|
112 |
|
113 |
if "Pharia" in model_info[0]['id']:
|
114 |
formatted_conversation = apply_pharia_template(messages=new_messages_a, add_generation_prompt=True)
|
|
|
227 |
try:
|
228 |
with gr.Column():
|
229 |
gr.HTML(htmL_info)
|
230 |
+
gr.HTML("<h2>Set prompt</h2>")
|
231 |
with gr.Row(variant="compact"):
|
232 |
with gr.Column(scale=0):
|
233 |
language_dropdown = gr.Dropdown(
|
|
|
242 |
value=system_prompts["English"],
|
243 |
show_copy_button=True
|
244 |
)
|
245 |
+
with gr.Accordion(label="Generation Configurations", open=False):
|
246 |
+
max_new_tokens = gr.Slider(minimum=128, maximum=4096, value=512, label="Max new tokens", step=128)
|
247 |
+
temperature = gr.Slider(minimum=0.0, maximum=1.0, value=0.7, label="Temperature", step=0.01)
|
248 |
+
top_p = gr.Slider(minimum=0.0, maximum=1.0, value=0.97, label="Top_p", step=0.01)
|
249 |
+
repetition_penalty = gr.Slider(minimum=0.1, maximum=2.0, value=1.1, label="Repetition Penalty", step=0.1)
|
250 |
+
|
251 |
with gr.Row(variant="panel"):
|
252 |
with gr.Column(scale=1):
|
253 |
submit_btn = gr.Button(value="Generate", variant="primary")
|
|
|
260 |
chatbot_b = gr.Chatbot(label="Model B", show_copy_button=True, height=500)
|
261 |
with gr.Row(variant="panel"):
|
262 |
better_bot = gr.Radio(["Bot A kicks ass!", "Bot B crushes it!", "It's a draw."], label="Rate the output!")
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
|
264 |
language_dropdown.change(
|
265 |
lambda lang: system_prompts[lang],
|