|
|
|
|
|
|
|
|
|
|
|
import gradio as gr
|
|
|
import pandas as pd
|
|
|
import joblib
|
|
|
from huggingface_hub import hf_hub_download
|
|
|
|
|
|
|
|
|
model_path = hf_hub_download(repo_id="Edalexan/ia-pkl", filename="exoplanet_model.pkl")
|
|
|
model = joblib.load(model_path)
|
|
|
|
|
|
def predict(feature1, feature2, feature3):
|
|
|
df = pd.DataFrame([[feature1, feature2, feature3]], columns=["feature1", "feature2", "feature3"])
|
|
|
pred = model.predict(df)[0]
|
|
|
prob = model.predict_proba(df)[0][1]
|
|
|
return {"prediction": int(pred), "probability": float(prob)}
|
|
|
|
|
|
|
|
|
iface = gr.Interface(
|
|
|
fn=predict,
|
|
|
inputs=["number", "number", "number"],
|
|
|
outputs="json"
|
|
|
)
|
|
|
|
|
|
iface.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|