Spaces:
Build error
Build error
| from transformers import pipeline | |
| import gradio as gr | |
| pipe = pipeline("text-classification", model="CAMeL-Lab/bert-base-arabic-camelbert-ca-sentiment") | |
| textbox = gr.Textbox(label="ادخل الجملة") | |
| textoutput1 = gr.Textbox(label="الشعور") | |
| textoutput2 = gr.Textbox(label="الدقة") | |
| #fuction that takes the text and returns 2 values(sentiment and confidence) | |
| def get_sentiment(text): | |
| result = pipe(text) | |
| sentiment = result[0]['label'] | |
| confidence = result[0]['score'] | |
| return sentiment, confidence | |
| #interface Gradio | |
| gr.Interface(fn=get_sentiment, inputs=textbox, outputs=[textoutput1, textoutput2]).launch() | |