ikigai-edu commited on
Commit
2422ebd
·
1 Parent(s): a2f9d16

Upload 3 files

Browse files
Files changed (3) hide show
  1. 18.jpg +0 -0
  2. 20.jpg +0 -0
  3. app.py +21 -0
18.jpg ADDED
20.jpg ADDED
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ import pandas as pd
4
+ import tensorflow as tf
5
+
6
+
7
+ load_model = tf.keras.models.load_model('./resnet50_food_model')
8
+
9
+ def predict(image_path):
10
+ img = Image.open(image_path)
11
+ img = img.resize((224, 224))
12
+ img = np.array(img)
13
+ img = np.expand_dims(img, 0)
14
+ pred = model.predict(img)
15
+ if pred > 0.5:
16
+ label = 'non-food'
17
+ else:
18
+ label = 'food'
19
+ return label
20
+
21
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(224, 224)), outputs=gr.outputs.Label(num_top_classes=2), enable_queue=True).launch()