Spaces:
Runtime error
Runtime error
| from transformers import pipeline | |
| import gradio as gr | |
| # Load SVM model from the local file path | |
| svm_model = pipeline("ankitdotpy/SVM_model_by_Group12") | |
| # Define prediction function | |
| def predict_sentiment(text): | |
| # Predict sentiment using the imported model | |
| result = svm_model.predict([text])[0] # Assuming svm_model is an sklearn SVM model | |
| return result | |
| # Create Gradio interface | |
| iface = gr.Interface( | |
| fn=predict_sentiment, | |
| inputs=gr.Textbox(placeholder="Enter Text", lines=10, label="Enter your text here:"), | |
| outputs=gr.Textbox(label="Sentiment"), | |
| title="Sentiment Analysis Developed by Group-12 (Ankit,Akshat,Gautam,Pritish) with ♥ from RCC Institute of Information Technology", | |
| description="Enter text and predict sentiment" | |
| ) | |
| iface.launch() | |