Update app.py
Browse files
app.py
CHANGED
@@ -70,11 +70,19 @@ processor = ViTImageProcessor.from_pretrained("ongkn/attraction-classifier")
|
|
70 |
|
71 |
pipe = pipeline("image-classification", model=model, feature_extractor=processor)
|
72 |
|
73 |
-
def classify_image(
|
74 |
-
face = grab_faces(np.array(
|
75 |
face = Image.fromarray(face)
|
76 |
result = pipe(face)
|
77 |
return result[0]["label"], result[0]["score"]
|
78 |
|
79 |
-
iface = gr.Interface(
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
pipe = pipeline("image-classification", model=model, feature_extractor=processor)
|
72 |
|
73 |
+
def classify_image(input):
|
74 |
+
face = grab_faces(np.array(input))
|
75 |
face = Image.fromarray(face)
|
76 |
result = pipe(face)
|
77 |
return result[0]["label"], result[0]["score"]
|
78 |
|
79 |
+
iface = gr.Interface(
|
80 |
+
fn=classify_image,
|
81 |
+
inputs="image",
|
82 |
+
outputs=[
|
83 |
+
{"type": "text", "label": "attraction class"},
|
84 |
+
{"type": "number", "label": "score (confidence)"}
|
85 |
+
],
|
86 |
+
description="Takes in a (224, 224) image and outputs an attraction class: {\"pos\", \"neg\"}"
|
87 |
+
)
|
88 |
+
iface.launch()
|