Spaces:
Runtime error
Runtime error
rlhf persona
Browse files
app.py
CHANGED
|
@@ -147,7 +147,7 @@ def chat(history1, history2, system_msg):
|
|
| 147 |
sleep(0.15)
|
| 148 |
|
| 149 |
|
| 150 |
-
def chosen_one(label, choice0_history, choice1_history, system_msg):
|
| 151 |
# Generate a uuid for each submission
|
| 152 |
arena_battle_id = str(uuid.uuid4())
|
| 153 |
|
|
@@ -164,7 +164,8 @@ def chosen_one(label, choice0_history, choice1_history, system_msg):
|
|
| 164 |
'choice0': choice0_history,
|
| 165 |
'choice1_name': model_manticore.name,
|
| 166 |
'choice1': choice1_history,
|
| 167 |
-
'label': label
|
|
|
|
| 168 |
}
|
| 169 |
)
|
| 170 |
|
|
@@ -199,6 +200,8 @@ with gr.Blocks() as arena:
|
|
| 199 |
choose2 = gr.Button(value="Prefer right", variant="secondary", visible=False).style(full_width=True)
|
| 200 |
with gr.Row():
|
| 201 |
with gr.Column():
|
|
|
|
|
|
|
| 202 |
message = gr.Textbox(
|
| 203 |
label="What do you want to chat about?",
|
| 204 |
placeholder="Ask me anything.",
|
|
@@ -242,7 +245,7 @@ with gr.Blocks() as arena:
|
|
| 242 |
)
|
| 243 |
|
| 244 |
choose1_click_event = choose1.click(
|
| 245 |
-
fn=chosen_one_first, inputs=[chatbot1, chatbot2, system_msg], outputs=[], queue=True
|
| 246 |
).then(
|
| 247 |
lambda *args: (
|
| 248 |
gr.update(visible=True, interactive=True),
|
|
@@ -257,7 +260,7 @@ with gr.Blocks() as arena:
|
|
| 257 |
)
|
| 258 |
|
| 259 |
choose2_click_event = choose2.click(
|
| 260 |
-
fn=chosen_one_second, inputs=[chatbot1, chatbot2, system_msg], outputs=[], queue=True
|
| 261 |
).then(
|
| 262 |
lambda *args: (
|
| 263 |
gr.update(visible=True, interactive=True),
|
|
|
|
| 147 |
sleep(0.15)
|
| 148 |
|
| 149 |
|
| 150 |
+
def chosen_one(label, choice0_history, choice1_history, system_msg, rlhf_persona):
|
| 151 |
# Generate a uuid for each submission
|
| 152 |
arena_battle_id = str(uuid.uuid4())
|
| 153 |
|
|
|
|
| 164 |
'choice0': choice0_history,
|
| 165 |
'choice1_name': model_manticore.name,
|
| 166 |
'choice1': choice1_history,
|
| 167 |
+
'label': label,
|
| 168 |
+
'rlhf_persona': rlhf_persona,
|
| 169 |
}
|
| 170 |
)
|
| 171 |
|
|
|
|
| 200 |
choose2 = gr.Button(value="Prefer right", variant="secondary", visible=False).style(full_width=True)
|
| 201 |
with gr.Row():
|
| 202 |
with gr.Column():
|
| 203 |
+
rlhf_persona = gr.Textbox(
|
| 204 |
+
"", label="Persona Tags", interactive=True, visible=True, placeholder="Tell us about how you are judging the quality. like #SFW #NSFW #helpful #ethical", lines=1)
|
| 205 |
message = gr.Textbox(
|
| 206 |
label="What do you want to chat about?",
|
| 207 |
placeholder="Ask me anything.",
|
|
|
|
| 245 |
)
|
| 246 |
|
| 247 |
choose1_click_event = choose1.click(
|
| 248 |
+
fn=chosen_one_first, inputs=[chatbot1, chatbot2, system_msg, rlhf_persona], outputs=[], queue=True
|
| 249 |
).then(
|
| 250 |
lambda *args: (
|
| 251 |
gr.update(visible=True, interactive=True),
|
|
|
|
| 260 |
)
|
| 261 |
|
| 262 |
choose2_click_event = choose2.click(
|
| 263 |
+
fn=chosen_one_second, inputs=[chatbot1, chatbot2, system_msg, rlhf_persona], outputs=[], queue=True
|
| 264 |
).then(
|
| 265 |
lambda *args: (
|
| 266 |
gr.update(visible=True, interactive=True),
|