Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from obstruction_detector import ObstructionDetector
|
| 3 |
+
|
| 4 |
+
# Crie um detector de obstrução
|
| 5 |
+
detector = ObstructionDetector()
|
| 6 |
+
|
| 7 |
+
def detect_obstruction(img_path):
|
| 8 |
+
# Chame a função de detecção do detector
|
| 9 |
+
report = detector.detect_obstruction(img_path)
|
| 10 |
+
return report
|
| 11 |
+
|
| 12 |
+
# Crie uma interface Gradio para a detecção de obstrução
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=detect_obstruction,
|
| 15 |
+
inputs=gr.inputs.File(),
|
| 16 |
+
outputs="text",
|
| 17 |
+
live=True,
|
| 18 |
+
title="Detector de Obstrução",
|
| 19 |
+
description="Carregue uma imagem para detectar obstrução.",
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
iface.launch()
|