Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from tensorflow.keras.models import Sequential
|
3 |
model = Sequential([
|
4 |
layers.experimental.preprocessing.Rescaling(1./255, input_shape=(img_height, img_width, 3)),
|
@@ -15,7 +27,7 @@ model = Sequential([
|
|
15 |
|
16 |
def predict_image(img):
|
17 |
img_2d=img.reshape(-1,180,180,3)
|
18 |
-
prediction=
|
19 |
return {class_names[i]: float(prediction[i]) for i in range(5)}
|
20 |
|
21 |
image = gr.inputs.Image(shape=(180,180))
|
|
|
1 |
import gradio as gr
|
2 |
+
import pickle
|
3 |
+
import matplotlib.pyplot as plt
|
4 |
+
import numpy as np
|
5 |
+
import os
|
6 |
+
import PIL
|
7 |
+
import tensorflow as tf
|
8 |
+
from tensorflow import keras
|
9 |
+
from tensorflow.keras import layers
|
10 |
+
|
11 |
+
model_final = pickle.load(open('model_f.pkl','rb'))
|
12 |
+
|
13 |
+
|
14 |
from tensorflow.keras.models import Sequential
|
15 |
model = Sequential([
|
16 |
layers.experimental.preprocessing.Rescaling(1./255, input_shape=(img_height, img_width, 3)),
|
|
|
27 |
|
28 |
def predict_image(img):
|
29 |
img_2d=img.reshape(-1,180,180,3)
|
30 |
+
prediction=model_final.predict(img_2d)[0]
|
31 |
return {class_names[i]: float(prediction[i]) for i in range(5)}
|
32 |
|
33 |
image = gr.inputs.Image(shape=(180,180))
|