Arabic-Review / app.py
CIAZIZ's picture
Update app.py
1aee5e6 verified
raw
history blame contribute delete
479 Bytes
import gradio as gr
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="CAMeL-Lab/bert-base-arabic-camelbert-mix-sentiment")
def analyze(message):
result = pipe(message)
result = result[0]
label = result['label']
score = result['score'] * 100
score = round(score, 2)
return f"{label}, {score}%"
start = gr.Interface(fn=analyze, inputs="text", outputs="text")
start.launch(debug=True)