ongkn commited on
Commit
9e1027a
·
1 Parent(s): 803689a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
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(inp):
74
- face = grab_faces(np.array(inp))
75
  face = Image.fromarray(face)
76
  result = pipe(face)
77
  return result[0]["label"], result[0]["score"]
78
 
79
- iface = gr.Interface(fn=classify_image, inputs="image", outputs=["text", "number"])
80
- iface.launch()
 
 
 
 
 
 
 
 
 
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()