import gradio as gr from transformers import pipeline # Load your model (make sure this is your actual model ID) emotion_classifier = pipeline("text-classification", model="ShahzadSohail/emotion_detection_model_final", return_all_scores=True) # Define the function to return prediction def predict_emotion(text): results = emotion_classifier(text) return results # Gradio interface (for UI) iface = gr.Interface(fn=predict_emotion, inputs=gr.Textbox(label="Enter Text"), outputs="json") # Enable API mode iface.launch(share=False)