Antonio
commited on
Commit
·
5214bf4
1
Parent(s):
7c883cc
Changed prediction output from JSON to HTML
Browse files
app.py
CHANGED
@@ -199,7 +199,7 @@ def predict(video_file, video_model_name, audio_model_name, framework_name):
|
|
199 |
|
200 |
delete_directory_path = "./temp/"
|
201 |
|
202 |
-
video_path, audio_path = separate_video_audio(video_file)
|
203 |
|
204 |
video_prediction = predict_video(video_path, video_model, image_processor)
|
205 |
|
@@ -212,11 +212,15 @@ def predict(video_file, video_model_name, audio_model_name, framework_name):
|
|
212 |
framework_function = decision_frameworks[framework_name]
|
213 |
consensus_label = framework_function(video_prediction, audio_prediction)
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
}
|
|
|
|
|
|
|
|
|
220 |
|
221 |
inputs = [
|
222 |
gr.Video(label="Upload Video"),
|
@@ -226,7 +230,7 @@ inputs = [
|
|
226 |
]
|
227 |
|
228 |
outputs = [
|
229 |
-
gr.
|
230 |
]
|
231 |
|
232 |
iface = gr.Interface(
|
|
|
199 |
|
200 |
delete_directory_path = "./temp/"
|
201 |
|
202 |
+
video_path, audio_path = separate_video_audio(video_file.name)
|
203 |
|
204 |
video_prediction = predict_video(video_path, video_model, image_processor)
|
205 |
|
|
|
212 |
framework_function = decision_frameworks[framework_name]
|
213 |
consensus_label = framework_function(video_prediction, audio_prediction)
|
214 |
|
215 |
+
delete_files_in_directory(delete_directory_path)
|
216 |
+
|
217 |
+
result = f"""
|
218 |
+
<h2>Predictions</h2>
|
219 |
+
<p><strong>Video Label:</strong> {highest_video_emotion}</p>
|
220 |
+
<p><strong>Audio Label:</strong> {highest_audio_emotion}</p>
|
221 |
+
<p><strong>Consensus Label:</strong> {consensus_label}</p>
|
222 |
+
"""
|
223 |
+
return result, video_file.name
|
224 |
|
225 |
inputs = [
|
226 |
gr.Video(label="Upload Video"),
|
|
|
230 |
]
|
231 |
|
232 |
outputs = [
|
233 |
+
gr.HTML(label="Predictions")
|
234 |
]
|
235 |
|
236 |
iface = gr.Interface(
|