Update app.py
Browse files
app.py
CHANGED
|
@@ -380,11 +380,11 @@ def ui_analyze(selected_idx: Optional[int], df: pd.DataFrame,
|
|
| 380 |
return "Analysis finished but returned no text. Check model settings and file format."
|
| 381 |
# Add a listening link at the end
|
| 382 |
url = _recording_url(unique_id)
|
| 383 |
-
return f"### Analysis result
|
| 384 |
|
| 385 |
{text}
|
| 386 |
|
| 387 |
-
**Recording:** {url}"
|
| 388 |
except Exception as e:
|
| 389 |
# Try to attach more error details
|
| 390 |
msg = str(e)
|
|
@@ -532,14 +532,14 @@ def ui_analyze_calls_by_date(
|
|
| 532 |
|
| 533 |
# Iterate filtered calls
|
| 534 |
results_blocks: List[str] = [
|
| 535 |
-
f"## Вынікі
|
| 536 |
Дата: {(date_str or _today_str()).strip()}
|
| 537 |
|
| 538 |
Фільтр: {t_from}–{t_to}{' | calltype=' + calltype if calltype else ''}
|
| 539 |
|
| 540 |
Знойдзена званкоў: {total}
|
| 541 |
|
| 542 |
-
---"
|
| 543 |
]
|
| 544 |
analyzed = 0
|
| 545 |
|
|
@@ -556,24 +556,16 @@ def ui_analyze_calls_by_date(
|
|
| 556 |
except Exception as e:
|
| 557 |
url = _recording_url(unique_id)
|
| 558 |
results_blocks.append(
|
| 559 |
-
f"### Call {i+1}
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
"
|
| 569 |
-
f"- Duration: {row.get('Duration','')}
|
| 570 |
-
"
|
| 571 |
-
f"- Recording: {url}
|
| 572 |
-
|
| 573 |
-
"
|
| 574 |
-
f"**Памылка загрузкі аўдыё:** {e}
|
| 575 |
-
"
|
| 576 |
-
"---"
|
| 577 |
)
|
| 578 |
continue
|
| 579 |
|
|
@@ -600,26 +592,18 @@ def ui_analyze_calls_by_date(
|
|
| 600 |
# Result block with listening URL
|
| 601 |
url = _recording_url(unique_id)
|
| 602 |
block = (
|
| 603 |
-
f"### Call {i+1}
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
"
|
| 613 |
-
f"- Duration: {row.get('Duration','')}
|
| 614 |
-
"
|
| 615 |
-
f"- Recording: {url}
|
| 616 |
-
|
| 617 |
-
"
|
| 618 |
-
f"**Analysis:**
|
| 619 |
|
| 620 |
{text}
|
| 621 |
-
"
|
| 622 |
-
"---"
|
| 623 |
)
|
| 624 |
results_blocks.append(block)
|
| 625 |
analyzed += 1
|
|
|
|
| 380 |
return "Analysis finished but returned no text. Check model settings and file format."
|
| 381 |
# Add a listening link at the end
|
| 382 |
url = _recording_url(unique_id)
|
| 383 |
+
return f"""### Analysis result
|
| 384 |
|
| 385 |
{text}
|
| 386 |
|
| 387 |
+
**Recording:** {url}"""
|
| 388 |
except Exception as e:
|
| 389 |
# Try to attach more error details
|
| 390 |
msg = str(e)
|
|
|
|
| 532 |
|
| 533 |
# Iterate filtered calls
|
| 534 |
results_blocks: List[str] = [
|
| 535 |
+
f"""## Вынікі
|
| 536 |
Дата: {(date_str or _today_str()).strip()}
|
| 537 |
|
| 538 |
Фільтр: {t_from}–{t_to}{' | calltype=' + calltype if calltype else ''}
|
| 539 |
|
| 540 |
Знойдзена званкоў: {total}
|
| 541 |
|
| 542 |
+
---"""
|
| 543 |
]
|
| 544 |
analyzed = 0
|
| 545 |
|
|
|
|
| 556 |
except Exception as e:
|
| 557 |
url = _recording_url(unique_id)
|
| 558 |
results_blocks.append(
|
| 559 |
+
f"""### Call {i+1}
|
| 560 |
+
- UniqueId: {unique_id}
|
| 561 |
+
- Start: {row.get('Start','')}
|
| 562 |
+
- CallerId: {row.get('CallerId','')}
|
| 563 |
+
- Destination: {row.get('Destination','')}
|
| 564 |
+
- Duration: {row.get('Duration','')}
|
| 565 |
+
- Recording: {url}
|
| 566 |
+
|
| 567 |
+
**Памылка загрузкі аўдыё:** {e}
|
| 568 |
+
---"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
)
|
| 570 |
continue
|
| 571 |
|
|
|
|
| 592 |
# Result block with listening URL
|
| 593 |
url = _recording_url(unique_id)
|
| 594 |
block = (
|
| 595 |
+
f"""### Call {i+1}
|
| 596 |
+
- UniqueId: {unique_id}
|
| 597 |
+
- Start: {row.get('Start','')}
|
| 598 |
+
- CallerId: {row.get('CallerId','')}
|
| 599 |
+
- Destination: {row.get('Destination','')}
|
| 600 |
+
- Duration: {row.get('Duration','')}
|
| 601 |
+
- Recording: {url}
|
| 602 |
+
|
| 603 |
+
**Analysis:**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
|
| 605 |
{text}
|
| 606 |
+
---"""
|
|
|
|
| 607 |
)
|
| 608 |
results_blocks.append(block)
|
| 609 |
analyzed += 1
|