File size: 904 Bytes
fe6772f
98fcba8
12baebe
 
 
 
 
 
 
 
 
 
 
 
66c4022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51e75cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()