oreo17 commited on
Commit
2e3c384
1 Parent(s): dfdcb11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -1,6 +1,11 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
 
 
 
 
4
  pipe = pipeline('image-classification')
5
 
6
  image = gr.inputs.Image(shape=(180,180))
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ def predict_image(img):
5
+ img_4d=img.reshape(-1,180,180,3)
6
+ prediction=model.predict(img_4d)[0]
7
+ return {class_names[i]: float(prediction[i]) for i in range(4)}
8
+
9
  pipe = pipeline('image-classification')
10
 
11
  image = gr.inputs.Image(shape=(180,180))