Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
|
3 |
+
import torch
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
def sentiment_predict(sentences):
|
9 |
+
pipe = pipeline("sentiment-analysis", model=repository_id, device=0, return_all_scores=True)
|
10 |
+
|
11 |
+
return pipe(sentences)
|
12 |
+
|
13 |
+
css_code='body{background-image:url("https://media.istockphoto.com/id/1256252051/vector/people-using-online-translation-app.jpg?s=612x612&w=0&k=20&c=aa6ykHXnSwqKu31fFR6r6Y1bYMS5FMAU9yHqwwylA94=");}'
|
14 |
+
|
15 |
+
demo = gr.Interface(
|
16 |
+
fn=sentiment_predict,
|
17 |
+
inputs=
|
18 |
+
gr.Textbox(label="sentence", placeholder=" Enter the sentence "),
|
19 |
+
|
20 |
+
|
21 |
+
outputs=[gr.Textbox(label="entity name")],
|
22 |
+
title="Arabic Named Entity Recognition",
|
23 |
+
description= "This is Arabic Named Entity Recognition System, it takes an arabian sentence as input and returns every entity name within it",
|
24 |
+
css = css_code
|
25 |
+
)
|
26 |
+
demo.launch()
|