ybbwcwaps
commited on
Commit
·
2b1d758
1
Parent(s):
9011f2d
UI demo
Browse files
app.py
CHANGED
|
@@ -5,23 +5,27 @@ model = get_model()
|
|
| 5 |
|
| 6 |
def greet(video):
|
| 7 |
print(video, type(video))
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
with gr.Blocks() as demo:
|
| 17 |
gr.Markdown("# Fake Video Detector")
|
| 18 |
with gr.Tabs():
|
| 19 |
with gr.TabItem("Video Detect"):
|
| 20 |
-
with gr.
|
| 21 |
-
video_input = gr.Video()
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
video_button.click(greet, inputs=video_input, outputs=detect_output)
|
| 26 |
|
| 27 |
demo.launch()
|
|
|
|
| 5 |
|
| 6 |
def greet(video):
|
| 7 |
print(video, type(video))
|
| 8 |
+
generated_pred = detect_video(video_path=video, model=model)
|
| 9 |
+
# generated_pred = 0.93443
|
| 10 |
+
# context_pred = 0.9164814352989197
|
| 11 |
+
# context_pred = 0.3335219025611877
|
| 12 |
+
context_pred = 0.7490718364715576
|
| 13 |
+
|
| 14 |
+
generated_output = f"Fake: {generated_pred*100:.2f}%" if generated_pred > 0.5 else f"Real: {(1-generated_pred)*100:.2f}%"
|
| 15 |
+
context_output = f"Fake: {context_pred*100:.2f}%" if context_pred > 0.5 else f"Real: {(1-context_pred)*100:.2f}%"
|
| 16 |
+
print(generated_output, '\n', context_output)
|
| 17 |
+
return generated_output, context_output
|
| 18 |
|
| 19 |
with gr.Blocks() as demo:
|
| 20 |
gr.Markdown("# Fake Video Detector")
|
| 21 |
with gr.Tabs():
|
| 22 |
with gr.TabItem("Video Detect"):
|
| 23 |
+
with gr.Column():
|
| 24 |
+
video_input = gr.Video(height=330)
|
| 25 |
+
video_button = gr.Button("detect")
|
| 26 |
+
detect_output = gr.Textbox(label="AI detect result")
|
| 27 |
+
context_output = gr.Textbox(label="Context detect result")
|
| 28 |
|
| 29 |
+
video_button.click(greet, inputs=video_input, outputs=[detect_output, context_output])
|
| 30 |
|
| 31 |
demo.launch()
|