Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,13 +10,20 @@ def predict(image: Image.Image):
|
|
| 10 |
label, confidence = model.predict(image)
|
| 11 |
result = "AI image" if label == 1 else "Real image"
|
| 12 |
return result, f"Confidence: {confidence:.2f}%"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
# Define the Gradio interface
|
| 16 |
demo = gr.Interface(
|
| 17 |
fn=predict,
|
| 18 |
inputs=gr.Image(type="pil"),
|
| 19 |
-
gradio.PlayableVideo("https://cdn-uploads.huggingface.co/production/uploads/66d6f1b3b50e35e1709bfdf7/x7Ud8PO9QPfmrTvBVcCKE.mp4"),
|
| 20 |
outputs=[gr.Textbox(), gr.Textbox()],
|
| 21 |
title="Vision Transformer Model",
|
| 22 |
description="Upload an image to classify it using the Vision Transformer model."
|
|
|
|
| 10 |
label, confidence = model.predict(image)
|
| 11 |
result = "AI image" if label == 1 else "Real image"
|
| 12 |
return result, f"Confidence: {confidence:.2f}%"
|
| 13 |
+
|
| 14 |
+
def video_identity(video):
|
| 15 |
+
return video
|
| 16 |
+
|
| 17 |
+
demo = gr.Interface(video_identity,
|
| 18 |
+
gr.Video(),
|
| 19 |
+
"https://cdn-uploads.huggingface.co/production/uploads/66d6f1b3b50e35e1709bfdf7/x7Ud8PO9QPfmrTvBVcCKE.mp4",
|
| 20 |
+
)
|
| 21 |
|
| 22 |
|
| 23 |
# Define the Gradio interface
|
| 24 |
demo = gr.Interface(
|
| 25 |
fn=predict,
|
| 26 |
inputs=gr.Image(type="pil"),
|
|
|
|
| 27 |
outputs=[gr.Textbox(), gr.Textbox()],
|
| 28 |
title="Vision Transformer Model",
|
| 29 |
description="Upload an image to classify it using the Vision Transformer model."
|