File size: 783 Bytes
cd0d72d
53ca8f4
7e130f8
d86f7a5
 
2632415
7e130f8
42c16e6
7e130f8
42c16e6
9759ce7
 
ae56bbd
7e130f8
 
 
 
185be16
9759ce7
185be16
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()