Spaces:
Sleeping
Sleeping
File size: 915 Bytes
aeaf137 8bac453 aeaf137 d8cfd07 8bac453 aeaf137 86c831d aeaf137 8bac453 aeaf137 86c831d aeaf137 8bac453 aeaf137 |
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 |
import gradio as gr
import pickle
import numpy as np
# Load your trained model
with open("model.pkl", "rb") as f: # Adjusted the path to model.pkl
model = pickle.load(f)
# Define a function to make predictions
def predict(feature1, feature2, feature3, feature4, feature5):
features = np.array([feature1, feature2, feature3, feature4, feature5]).reshape(1, -1)
prediction = model.predict(features)
#add here conversion to penguin type
return prediction[0]
# Create the Gradio interface
interface = gr.Interface(
fn=predict,
inputs=[
gr.inputs.Number(label="island"),
gr.inputs.Number(label="bill_length_mm"),
gr.inputs.Number(label="bill_depth_mm"),
gr.inputs.Number(label="flipper_length_mm"),
gr.inputs.Number(label="body_mass_g")
],
outputs="text",
title="Penguin Classifier"
)
if __name__ == "__main__":
interface.launch()
|