Spaces:
No application file
No application file
File size: 1,384 Bytes
e7c75bd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
import gradio as gr
import pandas as pd
import os
import cv2
# from inference import inference
from PIL import Image, ImageFilter
def prueba_inferencia(img):
df = pd.DataFrame({"Cell type": ["rbc", "wbc", "platelets"], "Count": [28, 55, 43]})
# Aplicar filtro gaussiano
img = cv2.imread(img, cv2.IMREAD_COLOR)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
return [img, df]
def run():
# Crear la interfaz de Gradio
interface = gr.Interface(
fn=prueba_inferencia,#inference
inputs=gr.Image(type="filepath"),
outputs=[gr.Image(type="pil"),
gr.BarPlot(
x="Cell type",
y="Count",
x_title="Cell type",
y_title="Count",
title="Cell Count",
tooltip=["Cell type", "Count"],
vertical=False,
y_lim=[0, 100],
)],
examples=[os.path.join("./data", img) for img in os.listdir("./data")],
title="Detección de Células Sanguíneas",
description="Sube una imagen de microscopio de células sanguíneas para detectar RBC, WBC y platelets."
)
# Ejecutar la aplicación
interface.launch(server_name="0.0.0.0", server_port=7860) # Se encuentra en http://127.0.0.1:7860/
if __name__ == "__main__":
run()
|