Eshieh2 commited on
Commit
be1db53
·
1 Parent(s): 52d93bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -1,3 +1,18 @@
1
  import gradio as gr
 
 
 
2
 
3
- gr.Interface.load("models/Eshieh2/jaguarid_pantanal").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import tensorflow as tf
3
+ import numpy as np
4
+ import requests
5
 
6
+ labels = []
7
+
8
+ def classify_image(inp):
9
+ model = tf.keras.models.load('saved_model')
10
+ inp = inp.reshape((-1, 480, 480, 3))
11
+ inp = tf.divide(inp,255.0)
12
+ prediction = model.predict(inp).flatten()
13
+ return {labels[i]: float(prediction[i]) for i in range(36)}
14
+
15
+ image = gr.inputs.Image(shape=(480, 480))
16
+ label = gr.outputs.Label(num_top_classes=3)
17
+
18
+ gr.Interface(fn=classify_image, inputs=image, outputs=label, capture_session=True, theme = "grass", examples = [["cat.jpeg"]]).launch()