yejimene commited on
Commit
2c57611
·
verified ·
1 Parent(s): ea23e62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -5,8 +5,11 @@ repo_id = "yejimene/clasificadorTexto"
5
  learner = from_pretrained_fastai(repo_id)
6
 
7
  def predict(text):
8
- prediction_output = learner.predict(text)
9
- print(f"Output de learner.predict('{text}'):")
10
- print(prediction_output) # Imprime la salida completa
11
- return "Resultado impreso en la consola"
 
 
 
12
  gr.Interface(fn=predict, inputs="text", outputs="label", examples=["This movie was terrible and boring.","I loved this movie, it was amazing!"]).launch(share=False)
 
5
  learner = from_pretrained_fastai(repo_id)
6
 
7
  def predict(text):
8
+ pred,pred_idx,probs = learner.predict(text)
9
+ if (pred == "0"):
10
+ return "Negative"
11
+ elif (pred == "1"):
12
+ return "Positive"
13
+ else:
14
+ return "Error"
15
  gr.Interface(fn=predict, inputs="text", outputs="label", examples=["This movie was terrible and boring.","I loved this movie, it was amazing!"]).launch(share=False)