mapecim commited on
Commit
2b9e59d
1 Parent(s): e534788

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -10,7 +10,13 @@ learner = from_pretrained_fastai(repo_id)
10
  # Definimos una funci贸n que se encarga de llevar a cabo las predicciones
11
  def predict(text):
12
  pred,pred_idx,probs = learner.predict(text)
13
- return pred
 
 
 
 
 
 
14
 
15
  # Creamos la interfaz y la lanzamos.
16
  gr.Interface(fn=predict, inputs="text", outputs="label", examples=["I loved that movie", "I hated that movie"]).launch()
 
10
  # Definimos una funci贸n que se encarga de llevar a cabo las predicciones
11
  def predict(text):
12
  pred,pred_idx,probs = learner.predict(text)
13
+ if (pred == "0") {
14
+ return "Negative"
15
+ } elif (pred == "1") {
16
+ return "Positive"
17
+ } else {
18
+ return "Error"
19
+ }
20
 
21
  # Creamos la interfaz y la lanzamos.
22
  gr.Interface(fn=predict, inputs="text", outputs="label", examples=["I loved that movie", "I hated that movie"]).launch()