Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,11 @@ import csv
|
|
5 |
import time
|
6 |
|
7 |
|
|
|
|
|
8 |
import requests
|
9 |
from PIL import Image
|
10 |
from torchvision import transforms
|
11 |
-
|
12 |
# Download human-readable labels for ImageNet.
|
13 |
response = requests.get("https://git.io/JJkYN")
|
14 |
labels = response.text.split("\n")
|
@@ -21,14 +22,29 @@ def predict(inp):
|
|
21 |
return confidences
|
22 |
|
23 |
import gradio as gr
|
24 |
-
|
25 |
-
gr.Interface(fn=predict,
|
26 |
inputs=gr.Image(type="pil"),
|
27 |
outputs=gr.Label(num_top_classes=3),
|
28 |
-
examples=["lion.jpg", "cheetah.jpg"])
|
29 |
|
|
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
|
34 |
uploaded_images = {'characters': {}, 'terrain': {}}
|
|
|
5 |
import time
|
6 |
|
7 |
|
8 |
+
|
9 |
+
# Image Classification Using Torch:
|
10 |
import requests
|
11 |
from PIL import Image
|
12 |
from torchvision import transforms
|
|
|
13 |
# Download human-readable labels for ImageNet.
|
14 |
response = requests.get("https://git.io/JJkYN")
|
15 |
labels = response.text.split("\n")
|
|
|
22 |
return confidences
|
23 |
|
24 |
import gradio as gr
|
25 |
+
interface1=gr.Interface(fn=predict,
|
|
|
26 |
inputs=gr.Image(type="pil"),
|
27 |
outputs=gr.Label(num_top_classes=3),
|
28 |
+
examples=["lion.jpg", "cheetah.jpg"])
|
29 |
|
30 |
+
# Image Classification Using VIT - Vision Image Transformers Architecture
|
31 |
|
32 |
+
import gradio as gr
|
33 |
+
interface2=gr.Interface.load(
|
34 |
+
"huggingface/google/vit-base-patch16-224",
|
35 |
+
examples=["alligator.jpg", "laptop.jpg"])
|
36 |
+
|
37 |
+
|
38 |
+
# ONNX Model Zoo:
|
39 |
+
|
40 |
+
gr.Markdown("""
|
41 |
+
|
42 |
+
https://github.com/onnx/models
|
43 |
+
|
44 |
+
""")
|
45 |
+
|
46 |
+
interface1.launch()
|
47 |
+
interface2.launch()
|
48 |
|
49 |
|
50 |
uploaded_images = {'characters': {}, 'terrain': {}}
|