Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -150,6 +150,9 @@ def add_query(to_add, history):
|
|
| 150 |
|
| 151 |
def qa_summarise(selected_queries, qa_llm_model, text_field, data_df):
|
| 152 |
|
|
|
|
|
|
|
|
|
|
| 153 |
qa_input_df = data_df[data_df["event_label"] != "none"].reset_index()
|
| 154 |
texts = qa_input_df[text_field].to_list()
|
| 155 |
|
|
@@ -258,23 +261,23 @@ with gr.Blocks(fill_width=True) as demo:
|
|
| 258 |
|
| 259 |
Note: QA process is disabled untill after the relevance classification is done
|
| 260 |
""")
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
hsummary = gr.Textbox(label="Summary")
|
| 279 |
|
| 280 |
qa_df = gr.DataFrame()
|
|
|
|
| 150 |
|
| 151 |
def qa_summarise(selected_queries, qa_llm_model, text_field, data_df):
|
| 152 |
|
| 153 |
+
if not selected_queries:
|
| 154 |
+
raise gr.Error(f"Error: You have to select one or more queries to ask.")
|
| 155 |
+
|
| 156 |
qa_input_df = data_df[data_df["event_label"] != "none"].reset_index()
|
| 157 |
texts = qa_input_df[text_field].to_list()
|
| 158 |
|
|
|
|
| 261 |
|
| 262 |
Note: QA process is disabled untill after the relevance classification is done
|
| 263 |
""")
|
| 264 |
+
with gr.Group():
|
| 265 |
+
with gr.Accordion("Parameters", open=False):
|
| 266 |
+
with gr.Row():
|
| 267 |
+
with gr.Column():
|
| 268 |
+
qa_llm_model = gr.Dropdown(["mistral", "solar", "phi3mini"], label="QA model", value="phi3mini", interactive=True)
|
| 269 |
+
aggregator = gr.Dropdown(["linear", "outrank"], label="Aggregation method", value="linear", interactive=True)
|
| 270 |
+
with gr.Column():
|
| 271 |
+
batch_size = gr.Slider(50, 500, value=150, step=1, label="Batch size", info="Choose between 50 and 500", interactive=True)
|
| 272 |
+
topk = gr.Slider(1, 10, value=5, step=1, label="Number of results to retrieve", info="Choose between 1 and 10", interactive=True)
|
| 273 |
+
|
| 274 |
+
selected_queries = gr.CheckboxGroup(label="Select at least one query using the checkboxes", interactive=True)
|
| 275 |
+
queries_state = gr.State()
|
| 276 |
+
qa_tab.select(init_queries, inputs=queries_state, outputs=[selected_queries, queries_state])
|
| 277 |
+
|
| 278 |
+
query_inp = gr.Textbox(label="Add custom queries like the one above, one at a time")
|
| 279 |
+
QA_addqry_button = gr.Button("Add to queries", interactive=False)
|
| 280 |
+
QA_run_button = gr.Button("Start QA", interactive=False)
|
| 281 |
hsummary = gr.Textbox(label="Summary")
|
| 282 |
|
| 283 |
qa_df = gr.DataFrame()
|