Om Prakash Singh
commited on
Commit
•
b08056e
1
Parent(s):
d251eff
Update app.py
Browse files
app.py
CHANGED
@@ -27,11 +27,6 @@ import tensorflow as tf
|
|
27 |
import gradio as gr
|
28 |
|
29 |
# Your code using these packages can follow here
|
30 |
-
|
31 |
-
|
32 |
-
# Your code using these packages can follow here
|
33 |
-
|
34 |
-
|
35 |
def remove_background_deeplab(image):
|
36 |
# Load the TensorFlow Lite model
|
37 |
interpreter = tf.lite.Interpreter(model_path="2.tflite")
|
@@ -41,7 +36,7 @@ def remove_background_deeplab(image):
|
|
41 |
output_details = interpreter.get_output_details()
|
42 |
|
43 |
# Convert the Gradio Image object to a NumPy array
|
44 |
-
image_np = np.array(image)
|
45 |
|
46 |
# Resize the image to match the expected input size of the model
|
47 |
input_size = (257, 257)
|
@@ -71,7 +66,9 @@ def remove_background_deeplab(image):
|
|
71 |
|
72 |
return result_image
|
73 |
|
74 |
-
|
75 |
# Example usage
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
27 |
import gradio as gr
|
28 |
|
29 |
# Your code using these packages can follow here
|
|
|
|
|
|
|
|
|
|
|
30 |
def remove_background_deeplab(image):
|
31 |
# Load the TensorFlow Lite model
|
32 |
interpreter = tf.lite.Interpreter(model_path="2.tflite")
|
|
|
36 |
output_details = interpreter.get_output_details()
|
37 |
|
38 |
# Convert the Gradio Image object to a NumPy array
|
39 |
+
image_np = np.array(image.data)
|
40 |
|
41 |
# Resize the image to match the expected input size of the model
|
42 |
input_size = (257, 257)
|
|
|
66 |
|
67 |
return result_image
|
68 |
|
|
|
69 |
# Example usage
|
70 |
+
gr.Interface(
|
71 |
+
fn=remove_background_deeplab,
|
72 |
+
inputs=gr.Image(label='Drop an Image or Open Camera to Classify'),
|
73 |
+
outputs=gr.Image()
|
74 |
+
).launch()
|