Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
model = pipeline("text-classification", model="mdeniz1/turkish-sentiment-analysis-bert-base-turkish-uncased") | |
def predict(prompt): | |
sentiment=model(prompt) | |
if sentiment[0]['label']=='LABEL_2': | |
return 'positive' | |
elif sentiment[0]['label']=='LABEL_1': | |
return 'neutral' | |
else: | |
return 'negative' | |
title = "Turkish Sentiment Analysis" | |
description = """ | |
The bot has been trained to analyze the sentiment of Turkish text. When provided with a Turkish prompt, it can determine whether the text expresses a neutral, negative, or positive sentiment. | |
""" | |
textbox = gr.Textbox(label="Enter a text here:", lines=1) | |
gr.Interface( | |
fn=predict, | |
inputs=textbox, | |
outputs="text", | |
title=title, | |
description=description, | |
examples=[["ortam oldukça güzel"], ["senden bir cacık olmaz"]], | |
).launch() |