File size: 853 Bytes
266d9b4
 
 
d63f9a0
266d9b4
 
c0203bb
 
d63f9a0
 
 
a94e576
d63f9a0
 
 
 
 
 
 
 
 
 
 
c0203bb
 
d63f9a0
 
266d9b4
 
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
## An python API for our Model
## Design by edander32 (Edmilson Alexandre) and jjambo(Joaquim Jambo)

import gradio as gr
import pandas as pd
import joblib
from huggingface_hub import hf_hub_download

# Carrega modelo
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)}

# Interface mínima só para expor a API
iface = gr.Interface(
    fn=predict,
    inputs=["number", "number", "number"],
    outputs="json"
)

iface.launch(server_name="0.0.0.0", server_port=7860)