Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -398,6 +398,8 @@ processor = LicensePlateProcessor()
|
|
398 |
|
399 |
# Modificar a função process_webcam_frame
|
400 |
def process_webcam_frame(frame, resize_factor):
|
|
|
|
|
401 |
# Redimensionar o frame com o fator fornecido
|
402 |
original_size = frame.shape[:2] # Altura e largura originais
|
403 |
new_size = (
|
@@ -412,17 +414,28 @@ def process_webcam_frame(frame, resize_factor):
|
|
412 |
# Processar o frame redimensionado
|
413 |
return processor.process_frame(resized_frame)
|
414 |
|
415 |
-
resize_factor = gr.Slider(
|
416 |
-
|
417 |
-
)
|
418 |
|
419 |
with gr.Blocks(head=js_to_prefere_the_back_camera_of_mobilephones()) as demo:
|
420 |
with gr.Row():
|
421 |
with gr.Column():
|
422 |
-
|
423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
with gr.Column():
|
425 |
-
|
|
|
|
|
|
|
|
|
426 |
|
427 |
# Atualizar stream para incluir o novo input
|
428 |
input_img.stream(
|
|
|
398 |
|
399 |
# Modificar a função process_webcam_frame
|
400 |
def process_webcam_frame(frame, resize_factor):
|
401 |
+
if frame is None:
|
402 |
+
return "Frame não detectado"
|
403 |
# Redimensionar o frame com o fator fornecido
|
404 |
original_size = frame.shape[:2] # Altura e largura originais
|
405 |
new_size = (
|
|
|
414 |
# Processar o frame redimensionado
|
415 |
return processor.process_frame(resized_frame)
|
416 |
|
417 |
+
# resize_factor = gr.Slider(
|
418 |
+
# minimum=0.1, maximum=3.0, step=0.1, value=1.0, label="Fator de Redimensionamento"
|
419 |
+
# )
|
420 |
|
421 |
with gr.Blocks(head=js_to_prefere_the_back_camera_of_mobilephones()) as demo:
|
422 |
with gr.Row():
|
423 |
with gr.Column():
|
424 |
+
# Criar entrada para webcam
|
425 |
+
input_img = gr.Image(
|
426 |
+
label="Webcam",
|
427 |
+
source="webcam",
|
428 |
+
streaming=True,
|
429 |
+
mirror_webcam=False
|
430 |
+
)
|
431 |
+
# Associar o slider ao layout
|
432 |
+
resize_factor_input = gr.Slider(minimum=0.1, maximum=3.0, step=0.1, value=1.0, label="Fator de Redimensionamento")
|
433 |
with gr.Column():
|
434 |
+
# Caixa de texto para saída
|
435 |
+
output_text = gr.Textbox(
|
436 |
+
label="Últimas 16 Placas Detectadas",
|
437 |
+
lines=20
|
438 |
+
)
|
439 |
|
440 |
# Atualizar stream para incluir o novo input
|
441 |
input_img.stream(
|