Spaces:
Runtime error
Runtime error
kz209
commited on
Commit
·
488c5c4
1
Parent(s):
4ea28ea
update
Browse files- pages/arena.py +17 -4
pages/arena.py
CHANGED
|
@@ -7,6 +7,12 @@ from utils.data import dataset
|
|
| 7 |
from utils.multiple_stream import stream_data
|
| 8 |
from pages.summarization_playground import get_model_batch_generation
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
def create_arena():
|
| 11 |
with open("prompt/prompt.json", "r") as file:
|
| 12 |
json_data = file.read()
|
|
@@ -14,14 +20,21 @@ def create_arena():
|
|
| 14 |
|
| 15 |
with gr.Blocks() as demo:
|
| 16 |
with gr.Group():
|
| 17 |
-
datapoint =
|
| 18 |
-
datapoint = datapoint['section_text'] + '\n\nDialogue:\n' + datapoint['dialogue']
|
| 19 |
gr.Markdown("""This arena is designed to compare different prompts. Click the button to stream responses from randomly shuffled prompts. Each column represents a response generated from one randomly selected prompt.
|
| 20 |
|
| 21 |
Once the streaming is complete, you can choose the best response.\u2764\ufe0f""")
|
| 22 |
|
| 23 |
-
gr.Textbox(label="
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
with gr.Row():
|
| 27 |
columns = [gr.Textbox(label=f"Prompt {i+1}", lines=10) for i in range(len(prompts))]
|
|
|
|
| 7 |
from utils.multiple_stream import stream_data
|
| 8 |
from pages.summarization_playground import get_model_batch_generation
|
| 9 |
|
| 10 |
+
def random_data_selection():
|
| 11 |
+
datapoint = random.choice(dataset)
|
| 12 |
+
datapoint = datapoint['section_text'] + '\n\nDialogue:\n' + datapoint['dialogue']
|
| 13 |
+
|
| 14 |
+
return datapoint
|
| 15 |
+
|
| 16 |
def create_arena():
|
| 17 |
with open("prompt/prompt.json", "r") as file:
|
| 18 |
json_data = file.read()
|
|
|
|
| 20 |
|
| 21 |
with gr.Blocks() as demo:
|
| 22 |
with gr.Group():
|
| 23 |
+
datapoint = random_data_selection()
|
|
|
|
| 24 |
gr.Markdown("""This arena is designed to compare different prompts. Click the button to stream responses from randomly shuffled prompts. Each column represents a response generated from one randomly selected prompt.
|
| 25 |
|
| 26 |
Once the streaming is complete, you can choose the best response.\u2764\ufe0f""")
|
| 27 |
|
| 28 |
+
data_textbox = gr.Textbox(label="Data", lines=10, placeholder="Datapoints to test...", value=datapoint)
|
| 29 |
+
with gr.row():
|
| 30 |
+
random_selection_button = gr.Button("Change Data")
|
| 31 |
+
submit_button = gr.Button("✨ Click to Streaming ✨")
|
| 32 |
+
|
| 33 |
+
random_selection_button.click(
|
| 34 |
+
fn=random_data_selection,
|
| 35 |
+
inputs=[],
|
| 36 |
+
outputs=data_textbox
|
| 37 |
+
)
|
| 38 |
|
| 39 |
with gr.Row():
|
| 40 |
columns = [gr.Textbox(label=f"Prompt {i+1}", lines=10) for i in range(len(prompts))]
|