Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ def sentiment_analysis_generate_table(text):
|
|
| 53 |
color: white;
|
| 54 |
}
|
| 55 |
.neutral {
|
| 56 |
-
background-color: rgb(
|
| 57 |
color: white;
|
| 58 |
}
|
| 59 |
th {
|
|
@@ -80,9 +80,9 @@ def sentiment_analysis_generate_table(text):
|
|
| 80 |
sentiment = result['label']
|
| 81 |
|
| 82 |
# Determine the sentiment class
|
| 83 |
-
if sentiment == "
|
| 84 |
sentiment_class = "positive"
|
| 85 |
-
elif sentiment == "
|
| 86 |
sentiment_class = "negative"
|
| 87 |
else:
|
| 88 |
sentiment_class = "neutral"
|
|
@@ -102,9 +102,9 @@ def sentiment_analysis_generate_table(text):
|
|
| 102 |
|
| 103 |
if __name__ == "__main__":
|
| 104 |
iface = gr.Interface(
|
| 105 |
-
sentiment_analysis_generate_table,
|
| 106 |
-
gr.Textbox(placeholder="Enter sentence here..."),
|
| 107 |
-
|
| 108 |
title="Hellenic Sentiment AI",
|
| 109 |
description="<p>A sentiment analysis model for primarily the Greek language</p>"
|
| 110 |
"<p>Enter some text to see whether the sentiment is positive, neutral or negative.</p>",
|
|
@@ -118,4 +118,4 @@ if __name__ == "__main__":
|
|
| 118 |
examples_per_page=2,
|
| 119 |
)
|
| 120 |
|
| 121 |
-
iface.launch()
|
|
|
|
| 53 |
color: white;
|
| 54 |
}
|
| 55 |
.neutral {
|
| 56 |
+
background-color: rgb(255, 165, 0);
|
| 57 |
color: white;
|
| 58 |
}
|
| 59 |
th {
|
|
|
|
| 80 |
sentiment = result['label']
|
| 81 |
|
| 82 |
# Determine the sentiment class
|
| 83 |
+
if sentiment.lower() == "positive":
|
| 84 |
sentiment_class = "positive"
|
| 85 |
+
elif sentiment.lower() == "negative":
|
| 86 |
sentiment_class = "negative"
|
| 87 |
else:
|
| 88 |
sentiment_class = "neutral"
|
|
|
|
| 102 |
|
| 103 |
if __name__ == "__main__":
|
| 104 |
iface = gr.Interface(
|
| 105 |
+
fn=sentiment_analysis_generate_table,
|
| 106 |
+
inputs=gr.Textbox(placeholder="Enter sentence here..."),
|
| 107 |
+
outputs=gr.HTML(),
|
| 108 |
title="Hellenic Sentiment AI",
|
| 109 |
description="<p>A sentiment analysis model for primarily the Greek language</p>"
|
| 110 |
"<p>Enter some text to see whether the sentiment is positive, neutral or negative.</p>",
|
|
|
|
| 118 |
examples_per_page=2,
|
| 119 |
)
|
| 120 |
|
| 121 |
+
iface.launch(share=True)
|