Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Cargar modelo desde Hugging Face
|
| 5 |
+
classifier = pipeline("text-classification", model="prabinpanta0/Patient-Readmission-Prediction")
|
| 6 |
+
|
| 7 |
+
# Funci贸n de predicci贸n
|
| 8 |
+
def predict_readmission(text):
|
| 9 |
+
result = classifier(text)
|
| 10 |
+
return f"Probabilidad de readmisi贸n: {result[0]['label']} (Score: {round(result[0]['score'], 2)})"
|
| 11 |
+
|
| 12 |
+
# Interfaz con Gradio
|
| 13 |
+
interface = gr.Interface(
|
| 14 |
+
fn=predict_readmission,
|
| 15 |
+
inputs=gr.Textbox(lines=4, placeholder="Ingresa la informaci贸n del paciente..."),
|
| 16 |
+
outputs="text",
|
| 17 |
+
title="Predicci贸n de Reingreso de Pacientes",
|
| 18 |
+
description="Este modelo predice si un paciente ser谩 readmitido al hospital seg煤n su historial."
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
interface.launch()
|