File size: 566 Bytes
6bfcf21 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import gradio as gr
import pandas as pd
import joblib
# Load your trained pipeline
model = joblib.load("full_pipeline.pkl")
def predict_from_csv(file):
df = pd.read_csv(file.name)
preds = model.predict(df)
return pd.DataFrame({"prediction": preds})
iface = gr.Interface(
fn=predict_from_csv,
inputs=gr.File(file_types=[".csv"]),
outputs="dataframe",
title="CSV Classifier",
description="Upload a CSV file with the correct columns, and the model will predict."
)
if __name__ == "__main__":
iface.launch()
|