Spaces:
Sleeping
Sleeping
Commit
Β·
8459fca
1
Parent(s):
5852c53
update
Browse files
app.py
CHANGED
|
@@ -101,7 +101,12 @@ def load_example(example_index):
|
|
| 101 |
|
| 102 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
| 103 |
gr.Markdown("## π§ TinyV - Answer Verification Tool\nThis tool verifies model-generated answers for correctness.")
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
with gr.Row():
|
| 106 |
with gr.Column(scale=1):
|
| 107 |
question = gr.Textbox(lines=3, label="π Question")
|
|
@@ -109,7 +114,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
|
| 109 |
model_answer = gr.Textbox(lines=3, label="π€ Model Answer")
|
| 110 |
|
| 111 |
gr.Markdown("### π Try Examples:")
|
| 112 |
-
example_buttons = []
|
| 113 |
with gr.Row():
|
| 114 |
for i, ex in enumerate(EXAMPLES):
|
| 115 |
btn = gr.Button(ex["name"], size="sm")
|
|
@@ -117,13 +121,12 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
|
| 117 |
fn=lambda idx=i: load_example(idx),
|
| 118 |
outputs=[question, ground_truth, model_answer, temperature, top_p, max_tokens]
|
| 119 |
)
|
| 120 |
-
example_buttons.append(btn)
|
| 121 |
|
| 122 |
with gr.Column(scale=1):
|
| 123 |
with gr.Accordion("βοΈ Advanced Settings", open=False):
|
| 124 |
-
temperature
|
| 125 |
-
top_p
|
| 126 |
-
max_tokens
|
| 127 |
|
| 128 |
verify_btn = gr.Button("β
Verify Answer", variant="primary")
|
| 129 |
result = gr.Textbox(label="π§Ύ Verification Result", lines=5, placeholder="Result will appear here...")
|
|
@@ -134,7 +137,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
|
| 134 |
outputs=result
|
| 135 |
)
|
| 136 |
|
| 137 |
-
# Launch the app
|
| 138 |
demo.queue()
|
| 139 |
if __name__ == "__main__":
|
| 140 |
-
demo.launch()
|
|
|
|
| 101 |
|
| 102 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
| 103 |
gr.Markdown("## π§ TinyV - Answer Verification Tool\nThis tool verifies model-generated answers for correctness.")
|
| 104 |
+
|
| 105 |
+
# β
Define sliders first so they can be referenced later
|
| 106 |
+
temperature = gr.Slider(0, 1, value=0.3, step=0.1, label="Temperature", visible=False)
|
| 107 |
+
top_p = gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="Top-p", visible=False)
|
| 108 |
+
max_tokens = gr.Slider(1, 128, value=2, step=1, label="Max Tokens", visible=False)
|
| 109 |
+
|
| 110 |
with gr.Row():
|
| 111 |
with gr.Column(scale=1):
|
| 112 |
question = gr.Textbox(lines=3, label="π Question")
|
|
|
|
| 114 |
model_answer = gr.Textbox(lines=3, label="π€ Model Answer")
|
| 115 |
|
| 116 |
gr.Markdown("### π Try Examples:")
|
|
|
|
| 117 |
with gr.Row():
|
| 118 |
for i, ex in enumerate(EXAMPLES):
|
| 119 |
btn = gr.Button(ex["name"], size="sm")
|
|
|
|
| 121 |
fn=lambda idx=i: load_example(idx),
|
| 122 |
outputs=[question, ground_truth, model_answer, temperature, top_p, max_tokens]
|
| 123 |
)
|
|
|
|
| 124 |
|
| 125 |
with gr.Column(scale=1):
|
| 126 |
with gr.Accordion("βοΈ Advanced Settings", open=False):
|
| 127 |
+
temperature.visible = True
|
| 128 |
+
top_p.visible = True
|
| 129 |
+
max_tokens.visible = True
|
| 130 |
|
| 131 |
verify_btn = gr.Button("β
Verify Answer", variant="primary")
|
| 132 |
result = gr.Textbox(label="π§Ύ Verification Result", lines=5, placeholder="Result will appear here...")
|
|
|
|
| 137 |
outputs=result
|
| 138 |
)
|
| 139 |
|
|
|
|
| 140 |
demo.queue()
|
| 141 |
if __name__ == "__main__":
|
| 142 |
+
demo.launch()
|