kalebu commited on
Commit
b622630
1 Parent(s): 112af39

updated gradio interface

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -6,13 +6,19 @@ model = joblib.load("model.pkl")
6
 
7
 
8
  def get_sentiment(input_text):
9
- return model.predict([input_text])[0].capitalize()
 
 
 
 
 
10
 
11
 
12
  iface = gr.Interface(
13
  fn=get_sentiment,
14
- inputs="text",
15
- outputs=["text"],
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)