| 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() | |