Spaces:
Runtime error
Runtime error
Commit
·
8289c6f
1
Parent(s):
92bbd4b
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,8 +20,8 @@ ner_pipeline = pipeline(
|
|
| 20 |
)
|
| 21 |
|
| 22 |
examples = [
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
]
|
| 26 |
|
| 27 |
def sentiment_analysis(text):
|
|
@@ -35,19 +35,16 @@ def ner(text):
|
|
| 35 |
sentiment_demo = gr.Interface(
|
| 36 |
fn=sentiment_analysis,
|
| 37 |
inputs="text",
|
| 38 |
-
outputs="label"
|
| 39 |
-
interpretation="default",
|
| 40 |
-
title="Sentiment Classification")
|
| 41 |
|
| 42 |
ner_demo = gr.Interface(
|
| 43 |
ner,
|
| 44 |
"text",
|
| 45 |
gr.HighlightedText(),
|
| 46 |
-
examples=examples
|
| 47 |
-
title="Named Entity Recognition")
|
| 48 |
|
| 49 |
if __name__ == "__main__":
|
| 50 |
Parallel(sentiment_demo, ner_demo,
|
| 51 |
-
inputs=gr.Textbox(lines=
|
| 52 |
title="Entity Based Sentiment Analysis Indonesia",
|
| 53 |
examples=examples).launch()
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
examples = [
|
| 23 |
+
"Jokowi mengutuk POLRI atas kerusuhan yang terjadi di Malang",
|
| 24 |
+
"Lesti mengatakan bahwa dia ingin mencabut gugatannya kepada Bilar di Kejaksaan Agung"
|
| 25 |
]
|
| 26 |
|
| 27 |
def sentiment_analysis(text):
|
|
|
|
| 35 |
sentiment_demo = gr.Interface(
|
| 36 |
fn=sentiment_analysis,
|
| 37 |
inputs="text",
|
| 38 |
+
outputs="label")
|
|
|
|
|
|
|
| 39 |
|
| 40 |
ner_demo = gr.Interface(
|
| 41 |
ner,
|
| 42 |
"text",
|
| 43 |
gr.HighlightedText(),
|
| 44 |
+
examples=examples)
|
|
|
|
| 45 |
|
| 46 |
if __name__ == "__main__":
|
| 47 |
Parallel(sentiment_demo, ner_demo,
|
| 48 |
+
inputs=gr.Textbox(lines=10, label="Input Text", placeholder="Enter sentences here..."),
|
| 49 |
title="Entity Based Sentiment Analysis Indonesia",
|
| 50 |
examples=examples).launch()
|