sentiment / app.py
hasanmustafa0503's picture
Create app.py
163f8e3 verified
raw
history blame contribute delete
415 Bytes
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()