Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
import numpy as np
|
|
|
4 |
from huggingface_hub import from_pretrained_keras
|
5 |
|
6 |
|
7 |
-
|
|
|
8 |
|
9 |
|
10 |
def greet(image):
|
11 |
model = from_pretrained_keras("vahidrezanezhad/sbb_binarization")
|
|
|
12 |
prediction = model.predict(image.reshape(1,224,448,image.shape[2]))
|
13 |
prediction = tf.squeeze(tf.round(prediction))
|
14 |
|
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
import numpy as np
|
4 |
+
import cv2
|
5 |
from huggingface_hub import from_pretrained_keras
|
6 |
|
7 |
|
8 |
+
def resize_image(img_in,input_height,input_width):
|
9 |
+
return cv2.resize( img_in, ( input_width,input_height) ,interpolation=cv2.INTER_NEAREST)
|
10 |
|
11 |
|
12 |
def greet(image):
|
13 |
model = from_pretrained_keras("vahidrezanezhad/sbb_binarization")
|
14 |
+
image = resize_image(image, 224,448)
|
15 |
prediction = model.predict(image.reshape(1,224,448,image.shape[2]))
|
16 |
prediction = tf.squeeze(tf.round(prediction))
|
17 |
|