Spaces:
Sleeping
Sleeping
Commit
·
6bbf5d3
1
Parent(s):
c5aa1cd
Fix TypeError: cannot concatenate object of type 'dict' by converting dictionaries to DataFrames before appending to results list
Browse files- app.py +1 -1
- pipeline/process.py +5 -2
app.py
CHANGED
@@ -306,7 +306,7 @@ The structural analysis combines multiple similarity metrics to create a compreh
|
|
306 |
|
307 |
# Structural Analysis Tab
|
308 |
with gr.Tab("Structural Analysis"):
|
309 |
-
with gr.Accordion("ℹ️ About
|
310 |
if "Structural Analysis" in metric_tooltips:
|
311 |
gr.Markdown(value=metric_tooltips["Structural Analysis"], elem_classes="metric-description")
|
312 |
else:
|
|
|
306 |
|
307 |
# Structural Analysis Tab
|
308 |
with gr.Tab("Structural Analysis"):
|
309 |
+
with gr.Accordion("ℹ️ About", open=False, elem_classes="metric-info-accordion structural-info"):
|
310 |
if "Structural Analysis" in metric_tooltips:
|
311 |
gr.Markdown(value=metric_tooltips["Structural Analysis"], elem_classes="metric-description")
|
312 |
else:
|
pipeline/process.py
CHANGED
@@ -345,10 +345,12 @@ def process_texts(
|
|
345 |
if enable_semantic and "Semantic Similarity" in pair_metrics:
|
346 |
result_row["Semantic Similarity"] = pair_metrics["Semantic Similarity"]
|
347 |
|
348 |
-
|
|
|
|
|
349 |
|
350 |
# Update progressive DataFrame and send update if callback is provided
|
351 |
-
progressive_df = pd.
|
352 |
|
353 |
# Send progressive update if callback is provided
|
354 |
if progressive_callback is not None:
|
@@ -406,6 +408,7 @@ def process_texts(
|
|
406 |
|
407 |
# Create the metrics DataFrame
|
408 |
if results:
|
|
|
409 |
metrics_df = pd.concat(results, ignore_index=True)
|
410 |
else:
|
411 |
metrics_df = pd.DataFrame()
|
|
|
345 |
if enable_semantic and "Semantic Similarity" in pair_metrics:
|
346 |
result_row["Semantic Similarity"] = pair_metrics["Semantic Similarity"]
|
347 |
|
348 |
+
# Convert the dictionary to a DataFrame before appending
|
349 |
+
result_df = pd.DataFrame([result_row])
|
350 |
+
results.append(result_df)
|
351 |
|
352 |
# Update progressive DataFrame and send update if callback is provided
|
353 |
+
progressive_df = pd.concat(results, ignore_index=True)
|
354 |
|
355 |
# Send progressive update if callback is provided
|
356 |
if progressive_callback is not None:
|
|
|
408 |
|
409 |
# Create the metrics DataFrame
|
410 |
if results:
|
411 |
+
# Results are already DataFrames, so we can concatenate them directly
|
412 |
metrics_df = pd.concat(results, ignore_index=True)
|
413 |
else:
|
414 |
metrics_df = pd.DataFrame()
|