Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,9 +17,7 @@ feature_extractor = AutoImageProcessor.from_pretrained('0-ma/vit-geometric-shape
|
|
17 |
model = AutoModelForImageClassification.from_pretrained('0-ma/vit-geometric-shapes-tiny')
|
18 |
|
19 |
labels = []
|
20 |
-
def predict(
|
21 |
-
image = PILImage.create(img)
|
22 |
-
|
23 |
feature_extractor = AutoImageProcessor.from_pretrained('0-ma/vit-geometric-shapes-tiny')
|
24 |
model = AutoModelForImageClassification.from_pretrained('0-ma/vit-geometric-shapes-tiny')
|
25 |
inputs = feature_extractor(images=[image], return_tensors="pt")
|
@@ -36,4 +34,4 @@ description = "A geometric shape setector."
|
|
36 |
examples = ['example/1_None.jpg','example/2_Circle.jpg','example/3_Triangle.jpg','example/4_Square.jpg','example/5_Pentagone.jpg','example/6_Hexagone.jpg']
|
37 |
|
38 |
|
39 |
-
gr.Interface(fn=predict,inputs=gr.Image(),outputs=gr.Label(),title=title,description=description,examples=examples).launch()
|
|
|
17 |
model = AutoModelForImageClassification.from_pretrained('0-ma/vit-geometric-shapes-tiny')
|
18 |
|
19 |
labels = []
|
20 |
+
def predict(image):
|
|
|
|
|
21 |
feature_extractor = AutoImageProcessor.from_pretrained('0-ma/vit-geometric-shapes-tiny')
|
22 |
model = AutoModelForImageClassification.from_pretrained('0-ma/vit-geometric-shapes-tiny')
|
23 |
inputs = feature_extractor(images=[image], return_tensors="pt")
|
|
|
34 |
examples = ['example/1_None.jpg','example/2_Circle.jpg','example/3_Triangle.jpg','example/4_Square.jpg','example/5_Pentagone.jpg','example/6_Hexagone.jpg']
|
35 |
|
36 |
|
37 |
+
gr.Interface(fn=predict,inputs=gr.Image(type="pil"),outputs=gr.Label(),title=title,description=description,examples=examples).launch()
|