import gradio as gr from transformers import pipeline # Load the pre-trained model model = pipeline("text-classification", model="hasanmustafa0503/SentimentModel") # Define the inference function def predict_sentiment(text): result = model(text) return result # Create a Gradio interface interface = gr.Interface(fn=predict_sentiment, inputs="text", outputs="json") # Launch the app interface.launch()