import gradio as gr import tensorflow as tf import numpy as np import cv2 from huggingface_hub import from_pretrained_keras def resize_image(img_in,input_height,input_width): return cv2.resize( img_in, ( input_width,input_height) ,interpolation=cv2.INTER_NEAREST) def greet(image): model = from_pretrained_keras("vahidrezanezhad/sbb_binarization") image = resize_image(image, 224,448) prediction = model.predict(image.reshape(1,224,448,image.shape[2])) prediction = tf.squeeze(tf.round(prediction)) print(prediction.shape) #print(model.summary()) return "Hello " iface = gr.Interface(fn=greet, inputs=gr.Image(), outputs="text") iface.launch()