Spaces:
Running
Running
abrar-adnan
commited on
Commit
•
4b7f0df
1
Parent(s):
c2343d1
Update app.py
Browse files
app.py
CHANGED
@@ -79,6 +79,7 @@ def process_frame(frame):
|
|
79 |
try:
|
80 |
emotion = DeepFace.analyze(color_image,actions=['emotion'],detector_backend = backends[2],enforce_detection = False)# 2,3, 4 works
|
81 |
emotion_count += 1
|
|
|
82 |
except Exception as e:
|
83 |
emotion = 0
|
84 |
pass
|
@@ -111,11 +112,11 @@ def video_processing(video_file, encoded_video):
|
|
111 |
start_time = time.time()
|
112 |
|
113 |
transcription = getTranscription(video_file)
|
114 |
-
print(transcription)
|
115 |
text_emotion = analyze_emotion(transcription)
|
116 |
-
print(text_emotion)
|
117 |
text_sentiment = analyze_sentiment(transcription)
|
118 |
-
print(text_sentiment)
|
119 |
|
120 |
video_capture = cv2.VideoCapture(video_file)
|
121 |
on_camera = 0
|
@@ -135,6 +136,7 @@ def video_processing(video_file, encoded_video):
|
|
135 |
|
136 |
|
137 |
result, emotion = process_frame(frame)
|
|
|
138 |
if result:
|
139 |
if result == 'on_camera':
|
140 |
on_camera += 1
|
@@ -143,7 +145,8 @@ def video_processing(video_file, encoded_video):
|
|
143 |
total += 1
|
144 |
|
145 |
if emotion != 0:
|
146 |
-
print(emotion[0]['emotion'])
|
|
|
147 |
angry += emotion[0]['emotion']['angry']
|
148 |
disgust += emotion[0]['emotion']['disgust']
|
149 |
fear += emotion[0]['emotion']['fear']
|
|
|
79 |
try:
|
80 |
emotion = DeepFace.analyze(color_image,actions=['emotion'],detector_backend = backends[2],enforce_detection = False)# 2,3, 4 works
|
81 |
emotion_count += 1
|
82 |
+
print(emotion)
|
83 |
except Exception as e:
|
84 |
emotion = 0
|
85 |
pass
|
|
|
112 |
start_time = time.time()
|
113 |
|
114 |
transcription = getTranscription(video_file)
|
115 |
+
# print(transcription)
|
116 |
text_emotion = analyze_emotion(transcription)
|
117 |
+
# print(text_emotion)
|
118 |
text_sentiment = analyze_sentiment(transcription)
|
119 |
+
# print(text_sentiment)
|
120 |
|
121 |
video_capture = cv2.VideoCapture(video_file)
|
122 |
on_camera = 0
|
|
|
136 |
|
137 |
|
138 |
result, emotion = process_frame(frame)
|
139 |
+
print(emotion)
|
140 |
if result:
|
141 |
if result == 'on_camera':
|
142 |
on_camera += 1
|
|
|
145 |
total += 1
|
146 |
|
147 |
if emotion != 0:
|
148 |
+
# print(emotion[0]['emotion'])
|
149 |
+
|
150 |
angry += emotion[0]['emotion']['angry']
|
151 |
disgust += emotion[0]['emotion']['disgust']
|
152 |
fear += emotion[0]['emotion']['fear']
|