import pandas as pd import gradio as gr from autogluon.text import TextPredictor # Load your saved AutoGluon model predictor = TextPredictor.load("trained_autogluon") # Define a prediction function for text classification def classify_text(text): single_row = pd.DataFrame([text], columns=["text"]) prediction = predictor.predict(single_row) return prediction[0] # Create a Gradio interface demo = gr.Interface(fn=classify_text, inputs="text", outputs="label", title="AutoGluon Text Classification Demo") # Launch the app demo.launch()