ApurvaKondekar commited on
Commit
b5ee2c4
Β·
verified Β·
1 Parent(s): 648cd02
Files changed (1) hide show
  1. app.py +73 -217
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
- ## {icon} EMOTION DETECTED
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: 13px;
831
- color: #d8f0ff;
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: 14px;
884
- color: #a0c8d8;
885
- line-height: 1.6;
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: #d0e8f0;
912
- line-height: 1.6;
 
913
  }
914
 
915
  .emotion-chips {
@@ -997,7 +990,7 @@ h4 {
997
  }
998
 
999
  /* =====================================================
1000
- LABELS / TEXT β€” GLOBAL
1001
  ===================================================== */
1002
  label, .gr-label span, p, li {
1003
  font-family: 'Rajdhani', sans-serif !important;
@@ -1007,108 +1000,24 @@ label, .gr-label span, p, li {
1007
  letter-spacing: 1px !important;
1008
  }
1009
 
1010
- /* =====================================================
1011
- GRADIO COMPONENT LABELS (Video Input, Transcribed Speech etc.)
1012
- Target every possible selector Gradio uses across versions
1013
- ===================================================== */
1014
-
1015
- /* The label text above each component */
1016
- label > span,
1017
- label span,
1018
- .block label span,
1019
- .block > label > span,
1020
- fieldset > span,
1021
- fieldset span,
1022
- div[class*="label"] span,
1023
- span[data-testid*="label"],
1024
- .wrap > span,
1025
- span.svelte-1ipelgc,
1026
- .svelte-1ipelgc,
1027
- /* catch-all: any span that is a direct child of a label */
1028
- label > span:first-child {
1029
- color: #00f5ff !important;
1030
- font-family: 'Share Tech Mono', monospace !important;
1031
- font-size: 11px !important;
1032
- font-weight: 600 !important;
1033
- letter-spacing: 2.5px !important;
1034
- text-transform: uppercase !important;
1035
- opacity: 1 !important;
1036
- visibility: visible !important;
1037
- display: inline-block !important;
1038
- }
1039
-
1040
- /* Gradio wraps Video label differently β€” target via data-testid */
1041
- div[data-testid="video"] label span,
1042
- div[data-testid="video"] > div > label > span,
1043
- div[data-testid="textbox"] label span,
1044
- div[data-testid="textbox"] > div > label > span,
1045
- div[data-testid="label"] label span,
1046
- div[data-testid="label"] > div > label > span {
1047
- color: #00f5ff !important;
1048
  font-family: 'Share Tech Mono', monospace !important;
1049
- font-size: 11px !important;
1050
- letter-spacing: 2.5px !important;
1051
  text-transform: uppercase !important;
1052
  opacity: 1 !important;
1053
- visibility: visible !important;
1054
  }
1055
 
1056
  /* =====================================================
1057
- TEXTAREA / TEXTBOX CONTENT TEXT
1058
- ===================================================== */
1059
- textarea,
1060
- div[data-testid="textbox"] textarea,
1061
- div[data-testid="textbox"] input {
1062
- font-family: 'Share Tech Mono', monospace !important;
1063
- font-size: 13px !important;
1064
- background: #071828 !important;
1065
- border: 1px solid rgba(0, 245, 255, 0.3) !important;
1066
- border-radius: 4px !important;
1067
- color: #cff4ff !important;
1068
- caret-color: #00f5ff !important;
1069
- transition: all 0.3s !important;
1070
- letter-spacing: 0.5px !important;
1071
- line-height: 1.7 !important;
1072
- opacity: 1 !important;
1073
- visibility: visible !important;
1074
- -webkit-text-fill-color: #cff4ff !important;
1075
- }
1076
-
1077
- textarea:focus,
1078
- div[data-testid="textbox"] textarea:focus {
1079
- border-color: #00f5ff !important;
1080
- box-shadow: 0 0 15px rgba(0, 245, 255, 0.2), inset 0 0 10px rgba(0, 245, 255, 0.03) !important;
1081
- outline: none !important;
1082
- }
1083
-
1084
- textarea::placeholder,
1085
- div[data-testid="textbox"] textarea::placeholder {
1086
- color: rgba(0, 200, 220, 0.35) !important;
1087
- -webkit-text-fill-color: rgba(0, 200, 220, 0.35) !important;
1088
- font-style: italic !important;
1089
- }
1090
-
1091
- /* The outer textbox wrapper */
1092
- div[data-testid="textbox"] {
1093
- background: transparent !important;
1094
- }
1095
-
1096
- div[data-testid="textbox"] > label {
1097
- background: transparent !important;
1098
- }
1099
-
1100
- div[data-testid="textbox"] > label > textarea {
1101
- background: #071828 !important;
1102
- color: #cff4ff !important;
1103
- -webkit-text-fill-color: #cff4ff !important;
1104
- }
1105
-
1106
- /* =====================================================
1107
- ANALYZE BUTTON (main action buttons only)
1108
  ===================================================== */
1109
  .gr-button,
1110
  button[class*="primary"],
1111
- button[class*="lg"] {
1112
  font-family: 'Orbitron', monospace !important;
1113
  font-size: 13px !important;
1114
  font-weight: 700 !important;
@@ -1126,8 +1035,7 @@ button[class*="lg"] {
1126
  }
1127
 
1128
  .gr-button::before,
1129
- button[class*="primary"]::before,
1130
- button[class*="lg"]::before {
1131
  content: '' !important;
1132
  position: absolute !important;
1133
  top: 0; left: -100% !important;
@@ -1142,14 +1050,12 @@ button[class*="lg"]::before {
1142
  }
1143
 
1144
  .gr-button:hover::before,
1145
- button[class*="primary"]:hover::before,
1146
- button[class*="lg"]:hover::before {
1147
  left: 100% !important;
1148
  }
1149
 
1150
  .gr-button:hover,
1151
- button[class*="primary"]:hover,
1152
- button[class*="lg"]:hover {
1153
  background: rgba(0, 245, 255, 0.1) !important;
1154
  box-shadow:
1155
  0 0 20px rgba(0, 245, 255, 0.4),
@@ -1159,91 +1065,37 @@ button[class*="lg"]:hover {
1159
  }
1160
 
1161
  .gr-button:active,
1162
- button[class*="primary"]:active,
1163
- button[class*="lg"]:active {
1164
  transform: translateY(0px) !important;
1165
  }
1166
 
1167
  /* =====================================================
1168
- VIDEO UPLOAD / RECORD TAB BUTTONS
1169
- ===================================================== */
1170
- /* Target the small tab-style buttons under the video component */
1171
- button[class*="tab"],
1172
- div[class*="upload"] button,
1173
- div[class*="source"] button,
1174
- .source-selection button,
1175
- div[data-testid*="source"] button,
1176
- div[class*="wrap"] > div > button:not([class*="lg"]):not([class*="primary"]) {
1177
- font-family: 'Share Tech Mono', monospace !important;
1178
- font-size: 11px !important;
1179
- font-weight: 600 !important;
1180
- letter-spacing: 2px !important;
1181
- text-transform: uppercase !important;
1182
- background: rgba(0, 245, 255, 0.06) !important;
1183
- border: 1px solid rgba(0, 245, 255, 0.3) !important;
1184
- color: #a0dce8 !important;
1185
- border-radius: 3px !important;
1186
- padding: 6px 16px !important;
1187
- transition: all 0.25s ease !important;
1188
- cursor: pointer !important;
1189
- position: relative !important;
1190
- overflow: visible !important;
1191
- }
1192
-
1193
- button[class*="tab"]:hover,
1194
- div[class*="upload"] button:hover,
1195
- div[class*="source"] button:hover,
1196
- .source-selection button:hover,
1197
- div[data-testid*="source"] button:hover,
1198
- div[class*="wrap"] > div > button:not([class*="lg"]):not([class*="primary"]):hover {
1199
- background: rgba(0, 245, 255, 0.14) !important;
1200
- border-color: var(--neon-cyan) !important;
1201
- color: #ffffff !important;
1202
- transform: none !important;
1203
- box-shadow: 0 0 10px rgba(0, 245, 255, 0.2) !important;
1204
- }
1205
-
1206
- /* Active / selected tab */
1207
- button[class*="tab"][class*="selected"],
1208
- button[class*="tab"].selected,
1209
- button[aria-selected="true"] {
1210
- background: rgba(0, 245, 255, 0.15) !important;
1211
- border-color: var(--neon-cyan) !important;
1212
- color: #00f5ff !important;
1213
- box-shadow: 0 0 12px rgba(0, 245, 255, 0.25) !important;
1214
- }
1215
-
1216
- /* =====================================================
1217
- INPUT / TEXTAREA (fallback for non-testid elements)
1218
  ===================================================== */
1219
  textarea,
1220
  input[type="text"],
1221
- input[type="search"],
1222
- input:not([type="range"]) {
1223
  font-family: 'Share Tech Mono', monospace !important;
1224
  font-size: 13px !important;
1225
- background: #071828 !important;
1226
- border: 1px solid rgba(0, 245, 255, 0.3) !important;
1227
- border-radius: 4px !important;
1228
  color: #cff4ff !important;
1229
- -webkit-text-fill-color: #cff4ff !important;
1230
  transition: all 0.3s !important;
1231
  letter-spacing: 0.5px !important;
1232
- line-height: 1.7 !important;
1233
  }
1234
 
1235
  textarea:focus,
1236
  input:focus {
1237
- border-color: #00f5ff !important;
1238
- box-shadow: 0 0 15px rgba(0, 245, 255, 0.2) !important;
1239
  outline: none !important;
1240
  }
1241
 
 
1242
  textarea::placeholder,
1243
  input::placeholder {
1244
- color: rgba(0, 200, 220, 0.35) !important;
1245
- -webkit-text-fill-color: rgba(0, 200, 220, 0.35) !important;
1246
- font-style: italic !important;
1247
  }
1248
 
1249
  /* =====================================================
@@ -1257,33 +1109,6 @@ video {
1257
  inset 0 0 30px rgba(0, 0, 0, 0.5) !important;
1258
  }
1259
 
1260
- /* "Video Input" label text */
1261
- div[data-testid="video"] > div > label > span,
1262
- div[data-testid="video"] label span,
1263
- div[data-testid="video"] span {
1264
- color: #00f5ff !important;
1265
- font-family: 'Share Tech Mono', monospace !important;
1266
- font-size: 11px !important;
1267
- letter-spacing: 2.5px !important;
1268
- text-transform: uppercase !important;
1269
- opacity: 1 !important;
1270
- -webkit-text-fill-color: #00f5ff !important;
1271
- }
1272
-
1273
- /* "Click to Access Webcam" / "Drop Video Here" upload text */
1274
- div[data-testid="video"] .wrap span,
1275
- div[data-testid="video"] [class*="wrap"] span,
1276
- div[data-testid="video"] p,
1277
- div[data-testid="video"] [class*="upload"] span,
1278
- div[data-testid="video"] [class*="upload"] p {
1279
- color: #7bc8d8 !important;
1280
- font-family: 'Share Tech Mono', monospace !important;
1281
- font-size: 12px !important;
1282
- letter-spacing: 1.5px !important;
1283
- -webkit-text-fill-color: #7bc8d8 !important;
1284
- opacity: 1 !important;
1285
- }
1286
-
1287
  /* Upload zone */
1288
  .upload-zone,
1289
  div[class*="upload"] {
@@ -1496,6 +1321,37 @@ hr {
1496
  .info-grid { grid-template-columns: 1fr; }
1497
  .cyber-title { font-size: 26px !important; letter-spacing: 3px !important; }
1498
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1499
  """
1500
 
1501
  # =========================================================
@@ -1574,7 +1430,7 @@ with gr.Blocks(
1574
  # LEFT: Upload
1575
  with gr.Column(scale=1):
1576
 
1577
- gr.Markdown("## β—§ INPUT STREAM")
1578
 
1579
  video_input = gr.Video(
1580
  label="Video Input",
@@ -1582,7 +1438,7 @@ with gr.Blocks(
1582
  )
1583
 
1584
  predict_btn = gr.Button(
1585
- "⬑ INITIALIZE ANALYSIS",
1586
  variant="primary",
1587
  size="lg"
1588
  )
@@ -1590,7 +1446,7 @@ with gr.Blocks(
1590
  # RIGHT: Results
1591
  with gr.Column(scale=1):
1592
 
1593
- gr.Markdown("## β—¨ ANALYSIS OUTPUT")
1594
 
1595
  result_text = gr.Markdown(
1596
  value="""
@@ -1604,7 +1460,7 @@ with gr.Blocks(
1604
  )
1605
 
1606
  transcription_output = gr.Textbox(
1607
- label="β—ˆ Transcribed Speech",
1608
  lines=5,
1609
  interactive=False,
1610
  placeholder="Speech transcription will appear here after analysis..."
@@ -1613,7 +1469,7 @@ with gr.Blocks(
1613
  gr.HTML('<hr/>')
1614
 
1615
  # ── About Accordion ─────────────────────────────────
1616
- with gr.Accordion("β—† SYSTEM ARCHITECTURE", open=False):
1617
 
1618
  gr.HTML("""
1619
  <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 {
 
990
  }
991
 
992
  /* =====================================================
993
+ LABELS / TEXT
994
  ===================================================== */
995
  label, .gr-label span, p, li {
996
  font-family: 'Rajdhani', sans-serif !important;
 
1000
  letter-spacing: 1px !important;
1001
  }
1002
 
1003
+ /* Gradio component labels */
1004
+ .svelte-1ipelgc, span.svelte-1ipelgc,
1005
+ div[class*="label"] > span,
1006
+ .block > label > span {
1007
+ color: var(--neon-cyan) !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1008
  font-family: 'Share Tech Mono', monospace !important;
1009
+ font-size: 12px !important;
1010
+ letter-spacing: 2px !important;
1011
  text-transform: uppercase !important;
1012
  opacity: 1 !important;
 
1013
  }
1014
 
1015
  /* =====================================================
1016
+ ANALYZE BUTTON
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1017
  ===================================================== */
1018
  .gr-button,
1019
  button[class*="primary"],
1020
+ button {
1021
  font-family: 'Orbitron', monospace !important;
1022
  font-size: 13px !important;
1023
  font-weight: 700 !important;
 
1035
  }
1036
 
1037
  .gr-button::before,
1038
+ button::before {
 
1039
  content: '' !important;
1040
  position: absolute !important;
1041
  top: 0; left: -100% !important;
 
1050
  }
1051
 
1052
  .gr-button:hover::before,
1053
+ button:hover::before {
 
1054
  left: 100% !important;
1055
  }
1056
 
1057
  .gr-button:hover,
1058
+ button:hover {
 
1059
  background: rgba(0, 245, 255, 0.1) !important;
1060
  box-shadow:
1061
  0 0 20px rgba(0, 245, 255, 0.4),
 
1065
  }
1066
 
1067
  .gr-button:active,
1068
+ button:active {
 
1069
  transform: translateY(0px) !important;
1070
  }
1071
 
1072
  /* =====================================================
1073
+ INPUT / TEXTAREA
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1074
  ===================================================== */
1075
  textarea,
1076
  input[type="text"],
1077
+ input {
 
1078
  font-family: 'Share Tech Mono', monospace !important;
1079
  font-size: 13px !important;
1080
+ background: #071020 !important;
1081
+ border: 1px solid rgba(0, 245, 255, 0.25) !important;
1082
+ border-radius: 3px !important;
1083
  color: #cff4ff !important;
 
1084
  transition: all 0.3s !important;
1085
  letter-spacing: 0.5px !important;
 
1086
  }
1087
 
1088
  textarea:focus,
1089
  input:focus {
1090
+ border-color: var(--neon-cyan) !important;
1091
+ box-shadow: 0 0 15px rgba(0, 245, 255, 0.25) !important;
1092
  outline: none !important;
1093
  }
1094
 
1095
+ /* placeholder */
1096
  textarea::placeholder,
1097
  input::placeholder {
1098
+ color: rgba(127, 184, 204, 0.45) !important;
 
 
1099
  }
1100
 
1101
  /* =====================================================
 
1109
  inset 0 0 30px rgba(0, 0, 0, 0.5) !important;
1110
  }
1111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1112
  /* Upload zone */
1113
  .upload-zone,
1114
  div[class*="upload"] {
 
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
+ /* FIX INVISIBLE VIDEO BUTTON ICONS */
1338
+
1339
+ button svg,
1340
+ button span,
1341
+ button {
1342
+ color: #00f5ff !important;
1343
+ fill: #00f5ff !important;
1344
+ opacity: 1 !important;
1345
+ }
1346
+
1347
+ /* specifically for video action buttons */
1348
+ div[data-testid="video"] button {
1349
+ color: #00f5ff !important;
1350
+ fill: #00f5ff !important;
1351
+ background: #071020 !important;
1352
+ border: 1px solid #00f5ff !important;
1353
+ }
1354
+
1355
  """
1356
 
1357
  # =========================================================
 
1430
  # LEFT: Upload
1431
  with gr.Column(scale=1):
1432
 
1433
+ gr.Markdown("## INPUT STREAM")
1434
 
1435
  video_input = gr.Video(
1436
  label="Video Input",
 
1438
  )
1439
 
1440
  predict_btn = gr.Button(
1441
+ "ANALYZE EMOTION",
1442
  variant="primary",
1443
  size="lg"
1444
  )
 
1446
  # RIGHT: Results
1447
  with gr.Column(scale=1):
1448
 
1449
+ gr.Markdown("## ANALYSIS OUTPUT")
1450
 
1451
  result_text = gr.Markdown(
1452
  value="""
 
1460
  )
1461
 
1462
  transcription_output = gr.Textbox(
1463
+ label="Transcribed Speech",
1464
  lines=5,
1465
  interactive=False,
1466
  placeholder="Speech transcription will appear here after analysis..."
 
1469
  gr.HTML('<hr/>')
1470
 
1471
  # ── About Accordion ─────────────────────────────────
1472
+ with gr.Accordion("SYSTEM ARCHITECTURE", open=False):
1473
 
1474
  gr.HTML("""
1475
  <div class="arch-grid">