app.py 4
Browse files
app.py
CHANGED
|
@@ -489,21 +489,12 @@ def predict_emotion(video_file):
|
|
| 489 |
|
| 490 |
confidence = float(probs.max())
|
| 491 |
|
| 492 |
-
emotion_icons = {
|
| 493 |
-
"angry": "β‘",
|
| 494 |
-
"happy": "β",
|
| 495 |
-
"neutral": "β",
|
| 496 |
-
"sad": "β"
|
| 497 |
-
}
|
| 498 |
-
|
| 499 |
-
icon = emotion_icons.get(predicted_emotion, "β")
|
| 500 |
-
|
| 501 |
result_text = f"""
|
| 502 |
-
##
|
| 503 |
-
|
| 504 |
-
### `{predicted_emotion.upper()}`
|
| 505 |
-
|
| 506 |
-
**Neural Confidence:** `{confidence:.2%}`
|
| 507 |
"""
|
| 508 |
|
| 509 |
if os.path.exists(audio_path):
|
|
@@ -827,12 +818,13 @@ body::after {
|
|
| 827 |
|
| 828 |
.card-row {
|
| 829 |
font-family: 'Share Tech Mono', monospace;
|
| 830 |
-
font-size:
|
| 831 |
-
color: #
|
| 832 |
line-height: 2.2;
|
| 833 |
display: flex;
|
| 834 |
align-items: center;
|
| 835 |
gap: 10px;
|
|
|
|
| 836 |
}
|
| 837 |
|
| 838 |
.card-dot {
|
|
@@ -880,9 +872,9 @@ body::after {
|
|
| 880 |
|
| 881 |
.arch-desc {
|
| 882 |
font-family: 'Rajdhani', sans-serif;
|
| 883 |
-
font-size:
|
| 884 |
-
color: #
|
| 885 |
-
line-height: 1.
|
| 886 |
margin: 0 0 8px;
|
| 887 |
}
|
| 888 |
|
|
@@ -908,8 +900,9 @@ body::after {
|
|
| 908 |
.arch-detail {
|
| 909 |
font-family: 'Share Tech Mono', monospace;
|
| 910 |
font-size: 13px;
|
| 911 |
-
color: #
|
| 912 |
-
line-height: 1.
|
|
|
|
| 913 |
}
|
| 914 |
|
| 915 |
.emotion-chips {
|
|
@@ -1328,6 +1321,18 @@ hr {
|
|
| 1328 |
.info-grid { grid-template-columns: 1fr; }
|
| 1329 |
.cyber-title { font-size: 26px !important; letter-spacing: 3px !important; }
|
| 1330 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1331 |
"""
|
| 1332 |
|
| 1333 |
# =========================================================
|
|
@@ -1406,7 +1411,7 @@ with gr.Blocks(
|
|
| 1406 |
# LEFT: Upload
|
| 1407 |
with gr.Column(scale=1):
|
| 1408 |
|
| 1409 |
-
gr.Markdown("##
|
| 1410 |
|
| 1411 |
video_input = gr.Video(
|
| 1412 |
label="Video Input",
|
|
@@ -1414,7 +1419,7 @@ with gr.Blocks(
|
|
| 1414 |
)
|
| 1415 |
|
| 1416 |
predict_btn = gr.Button(
|
| 1417 |
-
"
|
| 1418 |
variant="primary",
|
| 1419 |
size="lg"
|
| 1420 |
)
|
|
@@ -1422,7 +1427,7 @@ with gr.Blocks(
|
|
| 1422 |
# RIGHT: Results
|
| 1423 |
with gr.Column(scale=1):
|
| 1424 |
|
| 1425 |
-
gr.Markdown("##
|
| 1426 |
|
| 1427 |
result_text = gr.Markdown(
|
| 1428 |
value="""
|
|
@@ -1436,7 +1441,7 @@ with gr.Blocks(
|
|
| 1436 |
)
|
| 1437 |
|
| 1438 |
transcription_output = gr.Textbox(
|
| 1439 |
-
label="
|
| 1440 |
lines=5,
|
| 1441 |
interactive=False,
|
| 1442 |
placeholder="Speech transcription will appear here after analysis..."
|
|
@@ -1445,7 +1450,7 @@ with gr.Blocks(
|
|
| 1445 |
gr.HTML('<hr/>')
|
| 1446 |
|
| 1447 |
# ββ About Accordion βββββββββββββββββββββββββββββββββ
|
| 1448 |
-
with gr.Accordion("
|
| 1449 |
|
| 1450 |
gr.HTML("""
|
| 1451 |
<div class="arch-grid">
|
|
|
|
| 489 |
|
| 490 |
confidence = float(probs.max())
|
| 491 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
result_text = f"""
|
| 493 |
+
## EMOTION DETECTED
|
| 494 |
+
|
| 495 |
+
### `{predicted_emotion.upper()}`
|
| 496 |
+
|
| 497 |
+
**Neural Confidence:** `{confidence:.2%}`
|
| 498 |
"""
|
| 499 |
|
| 500 |
if os.path.exists(audio_path):
|
|
|
|
| 818 |
|
| 819 |
.card-row {
|
| 820 |
font-family: 'Share Tech Mono', monospace;
|
| 821 |
+
font-size: 14px;
|
| 822 |
+
color: #ffffff !important;
|
| 823 |
line-height: 2.2;
|
| 824 |
display: flex;
|
| 825 |
align-items: center;
|
| 826 |
gap: 10px;
|
| 827 |
+
opacity: 1 !important;
|
| 828 |
}
|
| 829 |
|
| 830 |
.card-dot {
|
|
|
|
| 872 |
|
| 873 |
.arch-desc {
|
| 874 |
font-family: 'Rajdhani', sans-serif;
|
| 875 |
+
font-size: 15px;
|
| 876 |
+
color: #ffffff !important;
|
| 877 |
+
line-height: 1.8;
|
| 878 |
margin: 0 0 8px;
|
| 879 |
}
|
| 880 |
|
|
|
|
| 900 |
.arch-detail {
|
| 901 |
font-family: 'Share Tech Mono', monospace;
|
| 902 |
font-size: 13px;
|
| 903 |
+
color: #ffffff !important;
|
| 904 |
+
line-height: 1.8;
|
| 905 |
+
opacity: 1 !important;
|
| 906 |
}
|
| 907 |
|
| 908 |
.emotion-chips {
|
|
|
|
| 1321 |
.info-grid { grid-template-columns: 1fr; }
|
| 1322 |
.cyber-title { font-size: 26px !important; letter-spacing: 3px !important; }
|
| 1323 |
}
|
| 1324 |
+
|
| 1325 |
+
/* REMOVE GRADIO FOOTER + SETTINGS */
|
| 1326 |
+
|
| 1327 |
+
footer,
|
| 1328 |
+
.settings,
|
| 1329 |
+
button[title="Settings"],
|
| 1330 |
+
button[aria-label="Settings"],
|
| 1331 |
+
.gradio-footer,
|
| 1332 |
+
div[class*="settings"],
|
| 1333 |
+
div[class*="footer"] {
|
| 1334 |
+
display: none !important;
|
| 1335 |
+
}
|
| 1336 |
"""
|
| 1337 |
|
| 1338 |
# =========================================================
|
|
|
|
| 1411 |
# LEFT: Upload
|
| 1412 |
with gr.Column(scale=1):
|
| 1413 |
|
| 1414 |
+
gr.Markdown("## INPUT STREAM")
|
| 1415 |
|
| 1416 |
video_input = gr.Video(
|
| 1417 |
label="Video Input",
|
|
|
|
| 1419 |
)
|
| 1420 |
|
| 1421 |
predict_btn = gr.Button(
|
| 1422 |
+
"ANALYZE EMOTION",
|
| 1423 |
variant="primary",
|
| 1424 |
size="lg"
|
| 1425 |
)
|
|
|
|
| 1427 |
# RIGHT: Results
|
| 1428 |
with gr.Column(scale=1):
|
| 1429 |
|
| 1430 |
+
gr.Markdown("## ANALYSIS OUTPUT")
|
| 1431 |
|
| 1432 |
result_text = gr.Markdown(
|
| 1433 |
value="""
|
|
|
|
| 1441 |
)
|
| 1442 |
|
| 1443 |
transcription_output = gr.Textbox(
|
| 1444 |
+
label="Transcribed Speech",
|
| 1445 |
lines=5,
|
| 1446 |
interactive=False,
|
| 1447 |
placeholder="Speech transcription will appear here after analysis..."
|
|
|
|
| 1450 |
gr.HTML('<hr/>')
|
| 1451 |
|
| 1452 |
# ββ About Accordion βββββββββββββββββββββββββββββββββ
|
| 1453 |
+
with gr.Accordion("SYSTEM ARCHITECTURE", open=False):
|
| 1454 |
|
| 1455 |
gr.HTML("""
|
| 1456 |
<div class="arch-grid">
|