Jasper Gilley commited on
Commit
2aeb7d3
1 Parent(s): 6931808

updated return method and copy

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -12,13 +12,16 @@ def tweet_tester(tweet1, tweet2):
12
  diff_pct = (pred1 - pred2) / pred1 * 100
13
  # truncate diff_pct to 2 decimal places
14
  diff_pct = round(diff_pct, 3)
15
- return diff_pct
 
 
 
16
 
17
  interface = gr.Interface(
18
  title="Tweet A/B Test",
19
- description="Enter the text of two tweets you'd like to A/B test. The output number represents the percent difference in expected likes between the two tweets. If the number is positive, the second tweet is more likely to get more likes than the first tweet. If the number is negative, the first tweet is more likely to get more likes than the second tweet.",
20
  fn=tweet_tester,
21
  inputs=["text", "text"],
22
- outputs=["number"]
23
  )
24
- interface.launch()
 
12
  diff_pct = (pred1 - pred2) / pred1 * 100
13
  # truncate diff_pct to 2 decimal places
14
  diff_pct = round(diff_pct, 3)
15
+ if diff_pct > 0:
16
+ return f"tweet2 is {diff_pct}% better than tweet1"
17
+ else:
18
+ return f"tweet2 is {abs(diff_pct)}% worse than tweet1"
19
 
20
  interface = gr.Interface(
21
  title="Tweet A/B Test",
22
+ description="Enter the text of two tweets you'd like to A/B test. The output number represents the percent difference in expected likes between the two tweets.",
23
  fn=tweet_tester,
24
  inputs=["text", "text"],
25
+ outputs=["text"]
26
  )
27
+ interface.launch()