Spaces:
Sleeping
Sleeping
IndianServers
commited on
Commit
•
fdc6d7d
1
Parent(s):
6e7d4b9
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,11 @@
|
|
1 |
-
import tensorflow as tf
|
2 |
import gradio as gr
|
3 |
-
import numpy as np
|
4 |
import os
|
5 |
|
6 |
-
|
7 |
-
|
8 |
|
9 |
-
# Define the prediction function
|
10 |
-
def predict(image):
|
11 |
-
# Preprocess the image to the required input format
|
12 |
-
img = np.array(image).astype(np.float32)
|
13 |
-
img = np.expand_dims(img, axis=0) # Add batch dimension
|
14 |
-
img = tf.image.resize(img, (640, 640)) # Resize if needed
|
15 |
-
|
16 |
-
# Perform inference
|
17 |
-
predictions = model(img)
|
18 |
-
return predictions.numpy().tolist() # Adjust output processing as needed
|
19 |
-
|
20 |
-
# Set up the Gradio interface
|
21 |
image_input = gr.Image(type="pil")
|
22 |
-
|
23 |
|
24 |
-
interface = gr.Interface(fn=
|
25 |
-
interface.launch(server_port=os.getenv('GRADIO_SERVER_PORT', 7860))
|
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import os
|
3 |
|
4 |
+
def echo_image(image):
|
5 |
+
return image
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
image_input = gr.Image(type="pil")
|
8 |
+
image_output = gr.Image(type="pil")
|
9 |
|
10 |
+
interface = gr.Interface(fn=echo_image, inputs=image_input, outputs=image_output)
|
11 |
+
interface.launch(server_port=os.getenv('GRADIO_SERVER_PORT', 7860))
|