Spaces:
Sleeping
Sleeping
| import cv2 | |
| import numpy as np | |
| import gradio as gr | |
| from ultralytics import YOLO | |
| def predict(path:str): | |
| model = YOLO("yolov8s.yaml") | |
| model = YOLO("best-underwater.pt") | |
| imagen = cv2.imread(path) | |
| results = model.predict(source=path) | |
| for r in results: | |
| return r.plot() | |
| image_url = "https://huggingface.co/spaces/Jass0117/test/blob/main/diente.jpg" | |
| css = f""" | |
| .gradio-container {{ | |
| background-color: #ADD8E6; /* Fondo azul claro */ | |
| background-image: url('{image_url}'), | |
| url('{image_url}'), | |
| url('{image_url}'), | |
| url('{image_url}'); | |
| background-position: top left, top right, bottom left, bottom right; | |
| background-repeat: no-repeat; | |
| background-size: 100px 100px; /* Ajusta el tamaño de la imagen si es necesario */ | |
| }} | |
| """ | |
| with gr.Blocks(css=css) as demo: | |
| # Encabezado | |
| gr.Markdown("<h1 style='text-align: center;'>Bienvenido al Identificador de Piezas Dentales</h1>" | |
| "<p style='text-align: center;'>Por favor, cargue la radiografía que desea revisar.</p>") | |
| # Contenedor para la carga de imágenes y resultados | |
| with gr.Row(): | |
| with gr.Column(): | |
| input_image = gr.Image(type="filepath", label="Cargue su radiografía") | |
| with gr.Column(): | |
| output_image = gr.Image(type="numpy", label="Análisis") | |
| analyze_button = gr.Button("Analizar") | |
| analyze_button.click(fn=predict, inputs=input_image, outputs=output_image) | |
| demo.launch() |