litav commited on
Commit
83cac08
·
verified ·
1 Parent(s): a933cfb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -5
app.py CHANGED
@@ -1,6 +1,26 @@
1
- import os
 
 
2
 
3
- if os.path.exists("https://cdn-uploads.huggingface.co/production/uploads/66d6f1b3b50e35e1709bfdf7/x7Ud8PO9QPfmrTvBVcCKE.mp4"):
4
- print("The video file exists.")
5
- else:
6
- print("The video file does not exist.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+ from vit_model_test import CustomModel
4
 
5
+ # Initialize the model
6
+ model = CustomModel()
7
+
8
+ def predict(image: Image.Image):
9
+
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
+ outputs=[gr.Textbox(), gr.Textbox()],
20
+ title="Vision Transformer Model",
21
+ description="Upload an image to classify it using the Vision Transformer model."
22
+ )
23
+
24
+
25
+ # Launch the Gradio interface
26
+ demo.launch()