Spaces:
Build error
Build error
global meta
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def convert_result(pred, class_names=["Real", "Fake"]):
|
|
26 |
assert len(class_names) == len(preds), "Class / Prediction should have the same length"
|
27 |
return {n: p for n, p in zip(class_names, preds)}
|
28 |
|
29 |
-
def predict_fn(video
|
30 |
start = time.time()
|
31 |
prediction = predict_on_video(face_extractor=meta["face_extractor"],
|
32 |
video_path=video,
|
@@ -70,12 +70,12 @@ model = model_fn(model_dir)
|
|
70 |
if __name__ == '__main__':
|
71 |
video_path = "examples/nlurbvsozt.mp4"
|
72 |
model = model_fn(model_dir)
|
73 |
-
a, b = predict_fn(
|
74 |
print(a, b)
|
75 |
"""
|
76 |
# Create the Gradio demo
|
77 |
demo = gr.Interface(fn=predict_fn, # mapping function from input to output
|
78 |
-
inputs=
|
79 |
outputs=[gr.Label(num_top_classes=2, label="Predictions"), # what are the outputs?
|
80 |
gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
|
81 |
examples=example_list,
|
|
|
26 |
assert len(class_names) == len(preds), "Class / Prediction should have the same length"
|
27 |
return {n: p for n, p in zip(class_names, preds)}
|
28 |
|
29 |
+
def predict_fn(video):
|
30 |
start = time.time()
|
31 |
prediction = predict_on_video(face_extractor=meta["face_extractor"],
|
32 |
video_path=video,
|
|
|
70 |
if __name__ == '__main__':
|
71 |
video_path = "examples/nlurbvsozt.mp4"
|
72 |
model = model_fn(model_dir)
|
73 |
+
a, b = predict_fn(video_path)
|
74 |
print(a, b)
|
75 |
"""
|
76 |
# Create the Gradio demo
|
77 |
demo = gr.Interface(fn=predict_fn, # mapping function from input to output
|
78 |
+
inputs=gr.Video(),
|
79 |
outputs=[gr.Label(num_top_classes=2, label="Predictions"), # what are the outputs?
|
80 |
gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
|
81 |
examples=example_list,
|