TSingye commited on
Commit
976190a
1 Parent(s): 8841155

update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -1,15 +1,18 @@
1
  import gradio as gr
2
  import cv2
3
- class_names = ['Kharbandhi Lhakhang','Milarepa Lhakhang','Pasakha Lhakhang']
 
 
 
4
  img_height, img_width = 256, 256
5
  model = tf.keras.models.load_model('CSR_models.h5')
6
- image_output_class=class_names[np.argmax(predictions)]
7
  def greet(sample_image):
8
- sample_image_resized= cv2.resize(sample_image, (img_height,img_width))
9
- sample_image=np.expand_dims(sample_image_resized,axis=0)
10
- # Use the model for predictions
11
- predictions = model.predict(sample_image)
12
- image_output_class=class_names[np.argmax(predictions)]
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()