Ajaykanth Maddi commited on
Commit Β·
819ec9b
1
Parent(s): 04cba9b
UI Layout Changes
Browse files- app.py +16 -5
- constants.py +49 -1
app.py
CHANGED
|
@@ -69,7 +69,8 @@ from utils import (
|
|
| 69 |
)
|
| 70 |
|
| 71 |
from constants import (
|
| 72 |
-
CHUNKING_STRATEGIES
|
|
|
|
| 73 |
)
|
| 74 |
|
| 75 |
from ragbench import RAGSystem, Document, Chunk
|
|
@@ -328,11 +329,21 @@ with gr.Blocks(title="RAGBench Explorer") as demo:
|
|
| 328 |
submit_btn = gr.Button("π Run RAG Evaluation")
|
| 329 |
|
| 330 |
with gr.Row():
|
| 331 |
-
|
| 332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
|
| 334 |
-
gen_ans = gr.Textbox(label="π€ Generated Answer", lines=3)
|
| 335 |
-
metrics_box = gr.Textbox(label="π Evaluation Metrics", lines=8)
|
| 336 |
|
| 337 |
|
| 338 |
subset_dropdown.change(fn=update_question_list_and_info, inputs=[subset_dropdown], outputs=[question_dropdown, orig_ans_display, y_metrics_display])
|
|
|
|
| 69 |
)
|
| 70 |
|
| 71 |
from constants import (
|
| 72 |
+
CHUNKING_STRATEGIES,
|
| 73 |
+
default_json
|
| 74 |
)
|
| 75 |
|
| 76 |
from ragbench import RAGSystem, Document, Chunk
|
|
|
|
| 329 |
submit_btn = gr.Button("π Run RAG Evaluation")
|
| 330 |
|
| 331 |
with gr.Row():
|
| 332 |
+
with gr.Column(scale=2):
|
| 333 |
+
gr.Markdown("### π Original Answer and Metrics")
|
| 334 |
+
orig_ans_display = gr.Textbox(label="π Original Answer", lines=3, interactive=False)
|
| 335 |
+
y_metrics_display = gr.Textbox(label="y-metrics", lines=5, interactive=False)
|
| 336 |
+
|
| 337 |
+
with gr.Column(scale=2):
|
| 338 |
+
gr.Markdown("### π€ Generated Answer and Evaluation Metrics")
|
| 339 |
+
gen_ans = gr.Textbox(label="π€ Generated Answer", lines=3)
|
| 340 |
+
metrics_box = gr.Textbox(label="π Evaluation (y-pred) Metrics", lines=8)
|
| 341 |
+
|
| 342 |
+
with gr.Column(scale=2):
|
| 343 |
+
gr.Markdown("### π Analysis Results")
|
| 344 |
+
json_output = gr.JSON(label="Analysis Results", value=default_json, interactive=False)
|
| 345 |
+
|
| 346 |
|
|
|
|
|
|
|
| 347 |
|
| 348 |
|
| 349 |
subset_dropdown.change(fn=update_question_list_and_info, inputs=[subset_dropdown], outputs=[question_dropdown, orig_ans_display, y_metrics_display])
|
constants.py
CHANGED
|
@@ -23,4 +23,52 @@ CHUNKING_STRATEGIES = [
|
|
| 23 |
SENTENCE_BASED_LLAMA,
|
| 24 |
SMALL2BIG,
|
| 25 |
HYBRID
|
| 26 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
SENTENCE_BASED_LLAMA,
|
| 24 |
SMALL2BIG,
|
| 25 |
HYBRID
|
| 26 |
+
]
|
| 27 |
+
|
| 28 |
+
default_json = {
|
| 29 |
+
"relevance_explanation": "Documents 1 and 4 contain useful information for answering the question. Document 1 mentions 'Signal Information' and 'Self Diagnosis', which are relevant to finding signal information. Document 4 provides additional context about signal information, such as it being only available for digital channels.",
|
| 30 |
+
"all_relevant_sentence_keys": [
|
| 31 |
+
"1a",
|
| 32 |
+
"1b",
|
| 33 |
+
"4d",
|
| 34 |
+
"4e"
|
| 35 |
+
],
|
| 36 |
+
"overall_supported_explanation": "The response claims that signal information can be found in the 'Signal Information' or 'Self Diagnosis' section, and that the current channel must be a digital channel. Document 1 supports the first claim, and Document 4 supports the second claim. However, the response also mentions removing protective stickers, which is not directly related to finding signal information. Document 4 mentions removing stickers, but it is not directly supporting the response's claim.",
|
| 37 |
+
"overall_supported": true,
|
| 38 |
+
"sentence_support_information": [
|
| 39 |
+
{
|
| 40 |
+
"response_sentence_key": "a.",
|
| 41 |
+
"explanation": "Document 1 supports this sentence, as it mentions 'Signal Information' and 'Self Diagnosis' which are relevant to finding signal information.",
|
| 42 |
+
"supporting_sentence_keys": [
|
| 43 |
+
"1a",
|
| 44 |
+
"1b"
|
| 45 |
+
],
|
| 46 |
+
"fully_supported": true
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"response_sentence_key": "b.",
|
| 50 |
+
"explanation": "Document 4 supports this sentence, as it mentions that signal information is only available for digital channels. Additionally, Document 4 mentions removing protective stickers, which is also mentioned in the response.",
|
| 51 |
+
"supporting_sentence_keys": [
|
| 52 |
+
"4d",
|
| 53 |
+
"4e",
|
| 54 |
+
"4g"
|
| 55 |
+
],
|
| 56 |
+
"fully_supported": true
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"response_sentence_key": "c.",
|
| 60 |
+
"explanation": "Document 4 supports this sentence, as it explicitly states that signal information is only available for digital channels.",
|
| 61 |
+
"supporting_sentence_keys": [
|
| 62 |
+
"4e"
|
| 63 |
+
],
|
| 64 |
+
"fully_supported": true
|
| 65 |
+
}
|
| 66 |
+
],
|
| 67 |
+
"all_utilized_sentence_keys": [
|
| 68 |
+
"1a",
|
| 69 |
+
"1b",
|
| 70 |
+
"4d",
|
| 71 |
+
"4e",
|
| 72 |
+
"4g"
|
| 73 |
+
]
|
| 74 |
+
}
|