Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
from transformers import ViTImageProcessor, ViTForImageClassification
|
2 |
from PIL import Image
|
3 |
-
import requests
|
4 |
import gradio as gr
|
5 |
|
6 |
# Load the model and processor
|
@@ -21,11 +20,12 @@ def classify_image(image):
|
|
21 |
|
22 |
iface = gr.Interface(
|
23 |
fn=classify_image,
|
24 |
-
inputs=gr.
|
25 |
-
outputs=gr.
|
26 |
title="Image Classification with ViT",
|
27 |
description="Upload an image to classify it using the Vision Transformer (ViT) model."
|
28 |
)
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
iface.launch()
|
|
|
|
1 |
from transformers import ViTImageProcessor, ViTForImageClassification
|
2 |
from PIL import Image
|
|
|
3 |
import gradio as gr
|
4 |
|
5 |
# Load the model and processor
|
|
|
20 |
|
21 |
iface = gr.Interface(
|
22 |
fn=classify_image,
|
23 |
+
inputs=gr.Image(type="numpy", label="Upload an Image"),
|
24 |
+
outputs=gr.Textbox(label="Predicted Class"),
|
25 |
title="Image Classification with ViT",
|
26 |
description="Upload an image to classify it using the Vision Transformer (ViT) model."
|
27 |
)
|
28 |
|
29 |
if __name__ == "__main__":
|
30 |
iface.launch()
|
31 |
+
|