Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
import cv2
|
3 |
-
|
|
|
|
|
|
|
4 |
img_height, img_width = 256, 256
|
5 |
model = tf.keras.models.load_model('CSR_models.h5')
|
6 |
-
|
7 |
def greet(sample_image):
|
8 |
-
sample_image_resized= cv2.resize(sample_image, (img_height,img_width))
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
image_output_class
|
13 |
|
14 |
demo = gr.Interface(fn=greet, inputs="image", outputs="text")
|
15 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import cv2
|
3 |
+
import tensorflow as tf
|
4 |
+
import numpy as np
|
5 |
+
|
6 |
+
class_names = ['Kharbandhi Lhakhang', 'Milarepa Lhakhang', 'Pasakha Lhakhang']
|
7 |
img_height, img_width = 256, 256
|
8 |
model = tf.keras.models.load_model('CSR_models.h5')
|
9 |
+
|
10 |
def greet(sample_image):
|
11 |
+
sample_image_resized = cv2.resize(sample_image, (img_height, img_width))
|
12 |
+
sample_image_expanded = np.expand_dims(sample_image_resized, axis=0)
|
13 |
+
predictions = model.predict(sample_image_expanded)
|
14 |
+
image_output_class = class_names[np.argmax(predictions)]
|
15 |
+
return image_output_class
|
16 |
|
17 |
demo = gr.Interface(fn=greet, inputs="image", outputs="text")
|
18 |
demo.launch()
|