isboudja commited on
Commit
1ce8540
·
verified ·
1 Parent(s): babf18a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -13,9 +13,15 @@ labels = learner.dls.vocab
13
  # Define a function to make predictions
14
  def predict(text):
15
  prediction = learner.predict(text)
16
- print(prediction)
17
  pred, pred_idx, probs = prediction[:3]
18
- return {labels[i]: float(probs[i]) for i in range(len(labels))}
 
 
 
 
 
 
19
 
20
  # Create and launch the Gradio interface
21
  gr.Interface(
 
13
  # Define a function to make predictions
14
  def predict(text):
15
  prediction = learner.predict(text)
16
+
17
  pred, pred_idx, probs = prediction[:3]
18
+
19
+ negative_label, positive_label = labels
20
+
21
+ return {
22
+ negative_label: float(probs[0]),
23
+ positive_label: float(probs[1])
24
+ }
25
 
26
  # Create and launch the Gradio interface
27
  gr.Interface(