import gradio as gr import joblib # Only for demonstration, use joblib if your model is saved with joblib # Load your machine learning model # Replace this with your actual model loading code # Example with a dummy sentiment analysis model # model = joblib.load('your_model_path.joblib') def predict_sentiment(text): # Replace this with your actual model prediction code # Example with a dummy sentiment analysis model model = joblib.load("pipeline_model.joblib") prediction = model.predict([text]) return prediction # Create a Gradio interface iface = gr.Interface( fn=predict_sentiment, # Your prediction function inputs=gr.Textbox(), # Text input box outputs=gr.Textbox(), # Display prediction output live=True # Update predictions as you type ) # Launch the interface on a local server iface.launch()