File size: 429 Bytes
67f863f
 
 
81e5634
67f863f
 
81e5634
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline

# Load the sentiment analysis model
pipe = pipeline('sentiment-analysis')

# Function to pass user input to the pipeline
def analyze_sentiment(input_text):
    return pipe(input_text)

# Create the Gradio interface
demo = gr.Interface(
    fn=analyze_sentiment,
    inputs=gr.TextArea(label="Enter some text!"),
    outputs=gr.JSON(label="Sentiment Result")
)

demo.launch()