Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from segmentation import ImageSegmentation | |
| def image_segmentation(x, threshold_factor): | |
| segmetation = ImageSegmentation(x, threshold_factor) | |
| output_img = segmetation.segmented_img | |
| return output_img | |
| with gr.Blocks() as demo: | |
| gr.Markdown("Image Segmentation using Gradio") | |
| with gr.Tab("Image Segmentation"): | |
| with gr.Row(): | |
| image_input = gr.Image() | |
| image_output = gr.Image() | |
| temp_slider = gr.Slider( | |
| 0, 1, | |
| value=0.5, | |
| step=0.01, | |
| interactive=True, | |
| label="Threshold Factor", | |
| ) | |
| image_button = gr.Button("Flip") | |
| image_button.click(image_segmentation, inputs=[image_input, temp_slider], outputs=image_output) | |
| if __name__ == "__main__": | |
| demo.launch(server_name="0.0.0.0", server_port=7860) | |