Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -472,47 +472,47 @@ def format_results(analysis_result):
|
|
472 |
|
473 |
{f'''
|
474 |
<div class="alert-warning">
|
475 |
-
|
476 |
</div>
|
477 |
''' if analysis_result["verification_needed"] else ''}
|
478 |
|
479 |
<div class="grid grid-cols-2 gap-4">
|
480 |
<div class="space-y-4">
|
481 |
<div class="entity-section">
|
482 |
-
<h4
|
483 |
<ul>{''.join(f'<li>{person}</li>' for person in analysis_result['entities']['people']) or '<li>None detected</li>'}</ul>
|
484 |
</div>
|
485 |
|
486 |
<div class="entity-section">
|
487 |
-
<h4
|
488 |
<ul>{''.join(f'<li>{org}</li>' for org in analysis_result['entities']['organizations']) or '<li>None detected</li>'}</ul>
|
489 |
</div>
|
490 |
|
491 |
<div class="entity-section">
|
492 |
-
<h4
|
493 |
<ul>{''.join(f'<li>{loc}</li>' for loc in analysis_result['entities']['locations']) or '<li>None detected</li>'}</ul>
|
494 |
</div>
|
495 |
</div>
|
496 |
|
497 |
<div class="space-y-4">
|
498 |
<div class="entity-section">
|
499 |
-
<h4
|
500 |
<ul>{''.join(f'<li>{time}</li>' for time in analysis_result['entities']['temporal']) or '<li>None detected</li>'}</ul>
|
501 |
</div>
|
502 |
|
503 |
<div class="entity-section">
|
504 |
-
<h4
|
505 |
<ul>{''.join(f'<li>{tag}</li>' for tag in analysis_result['entities']['hashtags']) or '<li>None detected</li>'}</ul>
|
506 |
</div>
|
507 |
|
508 |
{f'''
|
509 |
<div class="entity-section">
|
510 |
-
<h4
|
511 |
<ul>
|
512 |
{''.join(f"""
|
513 |
<li class="mb-2">
|
514 |
-
<strong>{rel['source']}</strong>
|
515 |
-
<span class="text-blue-600">{rel['type'].replace('_to_', '
|
516 |
<strong>{rel['target']}</strong>
|
517 |
<br/>
|
518 |
<small class="text-gray-600">Confidence: {int(rel['confidence'] * 100)}%</small>
|
@@ -526,13 +526,13 @@ def format_results(analysis_result):
|
|
526 |
|
527 |
{f'''
|
528 |
<div class="alert-success mt-4">
|
529 |
-
|
530 |
</div>
|
531 |
''' if not analysis_result["verification_needed"] else ''}
|
532 |
|
533 |
{f'''
|
534 |
<div class="related-events">
|
535 |
-
<h4
|
536 |
<ul>
|
537 |
{''.join(f"""
|
538 |
<li class="mb-2">
|
@@ -551,7 +551,7 @@ def format_results(analysis_result):
|
|
551 |
''' if analysis_result.get('related_events') else ''}
|
552 |
|
553 |
<div class="entity-stats mt-4 p-4 bg-gray-50 rounded-lg">
|
554 |
-
<h4 class="mb-2"
|
555 |
<div class="grid grid-cols-3 gap-4 text-sm">
|
556 |
<div>
|
557 |
<strong>Confidence Breakdown:</strong>
|
|
|
472 |
|
473 |
{f'''
|
474 |
<div class="alert-warning">
|
475 |
+
⚠ <strong>Verification Required:</strong> Low confidence score detected. Please verify the extracted information.
|
476 |
</div>
|
477 |
''' if analysis_result["verification_needed"] else ''}
|
478 |
|
479 |
<div class="grid grid-cols-2 gap-4">
|
480 |
<div class="space-y-4">
|
481 |
<div class="entity-section">
|
482 |
+
<h4>People Detected</h4>
|
483 |
<ul>{''.join(f'<li>{person}</li>' for person in analysis_result['entities']['people']) or '<li>None detected</li>'}</ul>
|
484 |
</div>
|
485 |
|
486 |
<div class="entity-section">
|
487 |
+
<h4>Organizations</h4>
|
488 |
<ul>{''.join(f'<li>{org}</li>' for org in analysis_result['entities']['organizations']) or '<li>None detected</li>'}</ul>
|
489 |
</div>
|
490 |
|
491 |
<div class="entity-section">
|
492 |
+
<h4>Locations</h4>
|
493 |
<ul>{''.join(f'<li>{loc}</li>' for loc in analysis_result['entities']['locations']) or '<li>None detected</li>'}</ul>
|
494 |
</div>
|
495 |
</div>
|
496 |
|
497 |
<div class="space-y-4">
|
498 |
<div class="entity-section">
|
499 |
+
<h4>Temporal References</h4>
|
500 |
<ul>{''.join(f'<li>{time}</li>' for time in analysis_result['entities']['temporal']) or '<li>None detected</li>'}</ul>
|
501 |
</div>
|
502 |
|
503 |
<div class="entity-section">
|
504 |
+
<h4>Hashtags</h4>
|
505 |
<ul>{''.join(f'<li>{tag}</li>' for tag in analysis_result['entities']['hashtags']) or '<li>None detected</li>'}</ul>
|
506 |
</div>
|
507 |
|
508 |
{f'''
|
509 |
<div class="entity-section">
|
510 |
+
<h4>Entity Relationships</h4>
|
511 |
<ul>
|
512 |
{''.join(f"""
|
513 |
<li class="mb-2">
|
514 |
+
<strong>{rel['source']}</strong> →
|
515 |
+
<span class="text-blue-600">{rel['type'].replace('_to_', ' to ')}</span> →
|
516 |
<strong>{rel['target']}</strong>
|
517 |
<br/>
|
518 |
<small class="text-gray-600">Confidence: {int(rel['confidence'] * 100)}%</small>
|
|
|
526 |
|
527 |
{f'''
|
528 |
<div class="alert-success mt-4">
|
529 |
+
✅ <strong>Event Validated:</strong> The extracted information meets confidence thresholds.
|
530 |
</div>
|
531 |
''' if not analysis_result["verification_needed"] else ''}
|
532 |
|
533 |
{f'''
|
534 |
<div class="related-events">
|
535 |
+
<h4>Related Events</h4>
|
536 |
<ul>
|
537 |
{''.join(f"""
|
538 |
<li class="mb-2">
|
|
|
551 |
''' if analysis_result.get('related_events') else ''}
|
552 |
|
553 |
<div class="entity-stats mt-4 p-4 bg-gray-50 rounded-lg">
|
554 |
+
<h4 class="mb-2">Analysis Metrics</h4>
|
555 |
<div class="grid grid-cols-3 gap-4 text-sm">
|
556 |
<div>
|
557 |
<strong>Confidence Breakdown:</strong>
|