Spaces:
Sleeping
Sleeping
Download app.py from DHEIVER/ObstructionDetector: direct link, hf CLI and curl.
- Browser
- Download file 727 Bytes
-
https://huggingface.co/spaces/DHEIVER/ObstructionDetector/resolve/main/app.py
- Command line
-
hf download hf://spaces/DHEIVER/ObstructionDetector/app.py
-
curl -L -o app.py https://huggingface.co/spaces/DHEIVER/ObstructionDetector/resolve/main/app.py
727 Bytes
| import gradio as gr | |
| from PIL import Image | |
| # Import the ObstructionDetector class from your module | |
| from obstruction_detector import ObstructionDetector | |
| # Create an instance of ObstructionDetector | |
| detector = ObstructionDetector() | |
| # Define a Gradio function to process the image and return the report | |
| def process_image(image): | |
| # Call the detect_obstruction method of the ObstructionDetector with the PIL image | |
| report = detector.detect_obstruction(image) | |
| return report | |
| # Define the Gradio interface | |
| iface = gr.Interface(fn=process_image, | |
| inputs=gr.inputs.Image(shape=(224, 224)), # Adjust shape as needed | |
| outputs="text") | |
| # Launch the Gradio interface | |
| iface.launch() |