IndianServers commited on
Commit
fdc6d7d
1 Parent(s): 6e7d4b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -19
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
- # Load the model
7
- model = tf.saved_model.load('.')
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
- label_output = gr.Label(num_top_classes=3)
23
 
24
- interface = gr.Interface(fn=predict, inputs=image_input, outputs=label_output)
25
- interface.launch(server_port=os.getenv('GRADIO_SERVER_PORT', 7860)) # Use environment variable for port
 
 
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))