import pandas as pd import numpy as np import sklearn as sn from datasets import Dataset df=pd.read_csv("https://huggingface.co/spaces/Ralmao/Anemia/raw/main/Flujo_anemia.csv",encoding='latin-1', on_bad_lines='skip') dataset= Dataset.from_pandas(df) X = df.drop(['Flujo_Type'], axis = 1) y = df['Flujo_Type'] from sklearn.model_selection import train_test_split X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.30,random_state=42) from sklearn.ensemble import RandomForestClassifier clf = RandomForestClassifier(n_estimators=10) clf = clf.fit(X_train, y_train) clf import gradio as gr def predict_Flujotype(Hemoglobina): x = np.array([Hemoglobina]) pred = clf.predict(x.reshape(1, -1)) if pred == 1: return "Paciente con anemia empezar con un flujo de 220 e ir incrementando poco a poco hasta llegar a 300" else: return "Paciente sin anemia empezar con un flujo de 250 e ir incrementando poco a poco hasta llegar a 300" Hemoglobina = gr.Number(label='Hemoglobina') output = gr.Textbox(label='Flujo_Type') app = gr.Interface(predict_Flujotype,inputs = [Hemoglobina],outputs=output, description= 'This is a Flujo Type Predictor') app.launch(share=True)