Spaces:
Runtime error
Runtime error
updated gradio interface
Browse files
app.py
CHANGED
@@ -6,13 +6,19 @@ model = joblib.load("model.pkl")
|
|
6 |
|
7 |
|
8 |
def get_sentiment(input_text):
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
iface = gr.Interface(
|
13 |
fn=get_sentiment,
|
14 |
-
inputs=
|
15 |
-
outputs=[
|
16 |
-
title="Swahili Sentiment Analysis",
|
|
|
17 |
)
|
18 |
iface.launch(inline=False)
|
|
|
6 |
|
7 |
|
8 |
def get_sentiment(input_text):
|
9 |
+
predictions = model.predict_proba([input_text])
|
10 |
+
label = {
|
11 |
+
"negative":str(predictions[0][0]),
|
12 |
+
"positive":str(predictions[0][1]),
|
13 |
+
}
|
14 |
+
return label
|
15 |
|
16 |
|
17 |
iface = gr.Interface(
|
18 |
fn=get_sentiment,
|
19 |
+
inputs=[gr.Text(text="Sijapendezwa na tabia yake")],
|
20 |
+
outputs=[gr.Label(label='Sentiment')],
|
21 |
+
title="Swahili Sentiment Analysis using",
|
22 |
+
description="Swahili sentiment analysis is based on a Bayesian scikit-learn model"
|
23 |
)
|
24 |
iface.launch(inline=False)
|