papasega commited on
Commit
1929204
·
1 Parent(s): c0988bd

update app

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -18,9 +18,10 @@ def predict_fluency(text):
18
  probs = torch.softmax(logits, dim=1)
19
  label = torch.argmax(probs, dim=1).item()
20
  if label == 0:
21
- return "Low Fluency"
22
  else:
23
- return "High Fluency"
 
24
 
25
  iface = gr.Interface(fn=predict_fluency,
26
  inputs="text",
@@ -29,6 +30,8 @@ iface = gr.Interface(fn=predict_fluency,
29
  examples=[
30
  ["Engineer, Yeah, indeed, you know that the lady has a Phd. It's the 1st.",
31
  "Engineer, Yeah, indeed, you know that the lady has a Phd. It's the 1st."],
 
 
32
  [ "Oh, how was brown for you?",
33
  "Oh, how was brown for you?"],
34
  [ "Now they can.",
@@ -36,7 +39,7 @@ iface = gr.Interface(fn=predict_fluency,
36
  [ "But kind of plastics like growing more social consciousness, right?",
37
  "But kind of plastics like growing more social consciousness, right?"]
38
  ]
39
- )
40
 
41
 
42
  iface.launch()
 
18
  probs = torch.softmax(logits, dim=1)
19
  label = torch.argmax(probs, dim=1).item()
20
  if label == 0:
21
+ label = "Low Fluency"
22
  else:
23
+ label = "High Fluency"
24
+ return f"{label}\nLow Fluency: {probs[0][0].item()}\nHigh Fluency: {probs[0][1].item()}"
25
 
26
  iface = gr.Interface(fn=predict_fluency,
27
  inputs="text",
 
30
  examples=[
31
  ["Engineer, Yeah, indeed, you know that the lady has a Phd. It's the 1st.",
32
  "Engineer, Yeah, indeed, you know that the lady has a Phd. It's the 1st."],
33
+ ["Engineer, indeed, the lady, an accomplished engineer, holds a prestigious Ph.D. It's her first achievement of such caliber.",
34
+ "Engineer, indeed, the lady, an accomplished engineer, holds a prestigious Ph.D. It's her first achievement of such caliber."],
35
  [ "Oh, how was brown for you?",
36
  "Oh, how was brown for you?"],
37
  [ "Now they can.",
 
39
  [ "But kind of plastics like growing more social consciousness, right?",
40
  "But kind of plastics like growing more social consciousness, right?"]
41
  ]
42
+
43
 
44
 
45
  iface.launch()