Spaces:
Sleeping
Sleeping
title
Browse files
app.py
CHANGED
@@ -7,9 +7,6 @@ from transformers import AutoImageProcessor, AutoModelForImageClassification
|
|
7 |
preprocessor = AutoImageProcessor.from_pretrained("google/mobilenet_v2_1.0_224")
|
8 |
model = AutoModelForImageClassification.from_pretrained("google/mobilenet_v2_1.0_224")
|
9 |
|
10 |
-
title = "Sandbox"
|
11 |
-
description = "Place to try various models"
|
12 |
-
|
13 |
def classify(image):
|
14 |
inputs = preprocessor(images=image, return_tensors="pt")
|
15 |
outputs = model(**inputs)
|
@@ -17,6 +14,6 @@ def classify(image):
|
|
17 |
predicted_class_idx = logits.argmax(-1).item()
|
18 |
return model.config.id2label[predicted_class_idx]
|
19 |
|
20 |
-
demo = gr.Interface(fn=classify, inputs="image", outputs="text")
|
21 |
|
22 |
demo.launch()
|
|
|
7 |
preprocessor = AutoImageProcessor.from_pretrained("google/mobilenet_v2_1.0_224")
|
8 |
model = AutoModelForImageClassification.from_pretrained("google/mobilenet_v2_1.0_224")
|
9 |
|
|
|
|
|
|
|
10 |
def classify(image):
|
11 |
inputs = preprocessor(images=image, return_tensors="pt")
|
12 |
outputs = model(**inputs)
|
|
|
14 |
predicted_class_idx = logits.argmax(-1).item()
|
15 |
return model.config.id2label[predicted_class_idx]
|
16 |
|
17 |
+
demo = gr.Interface(fn=classify, inputs="image", outputs="text", title="Sandbox")
|
18 |
|
19 |
demo.launch()
|