plomty commited on
Commit
c219cdc
β€’
1 Parent(s): 53332ed

Clean up and add examples

Browse files
Files changed (1) hide show
  1. app.py +7 -15
app.py CHANGED
@@ -13,21 +13,12 @@ class UrlClassifier:
13
 
14
  def predict(self, input_text: str):
15
  pred = self.pipeline(input_text, self.candidate_labels)
16
- # pred = self.pipeline(input_text)[0]
17
 
18
  sorted_preds = sorted(zip(pred['scores'], pred['labels']))
19
  result = {}
20
  for i in range(len(sorted_preds)):
21
  result[sorted_preds[i][1]] = sorted_preds[i][0]
22
-
23
- # result = {
24
- # "Sadness 😭": pred[0]["score"],
25
- # "Joy πŸ˜‚": pred[1]["score"],
26
- # "Love 😍": pred[2]["score"],
27
- # "Anger 😠": pred[3]["score"],
28
- # "Fear 😨": pred[4]["score"],
29
- # "Surprise 😲": pred[5]["score"],
30
- # }
31
  return result
32
 
33
 
@@ -43,11 +34,12 @@ def main():
43
  outputs="label",
44
  title="Ecommerce URL Classification",
45
  examples=[
46
- "I get so down when I'm alone",
47
- "I believe that today everything will work out",
48
- "It was so dark there I was afraid to go",
49
- "I loved the gift you gave me",
50
- "I was very surprised by your presentation.",
 
51
  ],
52
  )
53
 
 
13
 
14
  def predict(self, input_text: str):
15
  pred = self.pipeline(input_text, self.candidate_labels)
 
16
 
17
  sorted_preds = sorted(zip(pred['scores'], pred['labels']))
18
  result = {}
19
  for i in range(len(sorted_preds)):
20
  result[sorted_preds[i][1]] = sorted_preds[i][0]
21
+
 
 
 
 
 
 
 
 
22
  return result
23
 
24
 
 
34
  outputs="label",
35
  title="Ecommerce URL Classification",
36
  examples=[
37
+ "https://www.homedepot.com/p/MINKA-AIRE-Concept-II-44-in-Integrated-LED-Indoor-White-Ceiling-Fan-with-Light-with-Remote-Control-F518L-WH/310172695",
38
+ "https://www.allsaints.com/us/men/t-shirts/pinup-crew-t-shirt/USMG127X-162.html",
39
+ "https://www.ikea.com/us/en/cat/multifunctional-tables-57537/",
40
+ "https://www.rei.com/adventures/all-trips?cm_mmc=email_com_gm-_-20230102_ADV_AdventuresJanuary-_-010223-_-CTA1_NP_Adventures_23_00005&ev36=555141764&rmid=20230102_ADV_AdventuresJanuary&rrid=932052075&e",
41
+ "https://www.dsw.com/en/us/product/adidas-fluid-flow-2.0-running-shoe---womens/512360",
42
+ "https://www.homedepot.com/b/Tools-Power-Tools-Saws-Scroll-Saws/N-5yc1vZc67a?sortorder=desc&sortby=price"
43
  ],
44
  )
45