Spaces:
Sleeping
Sleeping
Sahil al farib commited on
Commit Β·
b75436e
1
Parent(s): 7dc5288
feat: redesign demo UI to side-by-side layout
Browse files- demo/app.py +20 -17
demo/app.py
CHANGED
|
@@ -138,7 +138,7 @@ with gr.Blocks(
|
|
| 138 |
title="FactEval β Hallucination Detector",
|
| 139 |
theme=gr.themes.Soft(primary_hue="blue", neutral_hue="slate"),
|
| 140 |
css="""
|
| 141 |
-
.gradio-container { max-width:
|
| 142 |
footer { display: none !important; }
|
| 143 |
""",
|
| 144 |
) as demo:
|
|
@@ -151,6 +151,7 @@ with gr.Blocks(
|
|
| 151 |
)
|
| 152 |
|
| 153 |
with gr.Row():
|
|
|
|
| 154 |
with gr.Column(scale=1):
|
| 155 |
answer_input = gr.Textbox(
|
| 156 |
label="LLM Answer",
|
|
@@ -170,19 +171,27 @@ with gr.Blocks(
|
|
| 170 |
lines=1,
|
| 171 |
)
|
| 172 |
check_btn = gr.Button("π Check Factuality", variant="primary", size="lg")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
-
|
| 175 |
-
highlighted_output = gr.HTML()
|
| 176 |
-
|
| 177 |
-
with gr.Row():
|
| 178 |
-
with gr.Column(scale=2):
|
| 179 |
-
gr.Markdown("### π Claim Details")
|
| 180 |
-
details_output = gr.HTML()
|
| 181 |
with gr.Column(scale=1):
|
| 182 |
-
|
|
|
|
| 183 |
|
| 184 |
-
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
check_btn.click(
|
| 188 |
fn=run_check,
|
|
@@ -190,12 +199,6 @@ with gr.Blocks(
|
|
| 190 |
outputs=[highlighted_output, details_output, summary_output, json_output],
|
| 191 |
)
|
| 192 |
|
| 193 |
-
gr.Examples(
|
| 194 |
-
examples=EXAMPLES,
|
| 195 |
-
inputs=[answer_input, context_input],
|
| 196 |
-
label="Try these examples",
|
| 197 |
-
)
|
| 198 |
-
|
| 199 |
demo.load(
|
| 200 |
fn=run_check,
|
| 201 |
inputs=[answer_input, context_input, calibrator_input],
|
|
|
|
| 138 |
title="FactEval β Hallucination Detector",
|
| 139 |
theme=gr.themes.Soft(primary_hue="blue", neutral_hue="slate"),
|
| 140 |
css="""
|
| 141 |
+
.gradio-container { max-width: 1400px !important; }
|
| 142 |
footer { display: none !important; }
|
| 143 |
""",
|
| 144 |
) as demo:
|
|
|
|
| 151 |
)
|
| 152 |
|
| 153 |
with gr.Row():
|
| 154 |
+
# LEFT COLUMN: Inputs & Examples
|
| 155 |
with gr.Column(scale=1):
|
| 156 |
answer_input = gr.Textbox(
|
| 157 |
label="LLM Answer",
|
|
|
|
| 171 |
lines=1,
|
| 172 |
)
|
| 173 |
check_btn = gr.Button("π Check Factuality", variant="primary", size="lg")
|
| 174 |
+
|
| 175 |
+
gr.Examples(
|
| 176 |
+
examples=EXAMPLES,
|
| 177 |
+
inputs=[answer_input, context_input],
|
| 178 |
+
label="Try these examples",
|
| 179 |
+
)
|
| 180 |
|
| 181 |
+
# RIGHT COLUMN: Outputs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
with gr.Column(scale=1):
|
| 183 |
+
gr.Markdown("### π Highlighted Answer")
|
| 184 |
+
highlighted_output = gr.HTML()
|
| 185 |
|
| 186 |
+
with gr.Row():
|
| 187 |
+
with gr.Column(scale=2):
|
| 188 |
+
gr.Markdown("### π Claim Details")
|
| 189 |
+
details_output = gr.HTML()
|
| 190 |
+
with gr.Column(scale=1):
|
| 191 |
+
summary_output = gr.HTML()
|
| 192 |
+
|
| 193 |
+
with gr.Accordion("Raw JSON Output", open=False):
|
| 194 |
+
json_output = gr.Code(language="json")
|
| 195 |
|
| 196 |
check_btn.click(
|
| 197 |
fn=run_check,
|
|
|
|
| 199 |
outputs=[highlighted_output, details_output, summary_output, json_output],
|
| 200 |
)
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
demo.load(
|
| 203 |
fn=run_check,
|
| 204 |
inputs=[answer_input, context_input, calibrator_input],
|