hjianganthony commited on
Commit
a93db09
·
1 Parent(s): 33f9644

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -32,7 +32,7 @@ examples = [
32
  ["A giraffe at Lincoln Park Zoo"]
33
  ]
34
 
35
- def main(sentence: str, score_type: str, threshold_cosine: float, threshold_jaccard: float):
36
  threshold = threshold_cosine if score_type == "cosine" else threshold_jaccard
37
  results = search_offers(sentence, df_offers_brand_retailer, category_dict, brand_belong_category_dict, score_type, threshold)
38
  message, processed_results = process_output(results)
@@ -45,7 +45,7 @@ def process_output(output):
45
  else:
46
  return "We found some great offers!", output
47
 
48
- gr.Interface(
49
  fn=main,
50
  inputs=[
51
  gr.Textbox(lines=1, placeholder="Type here..."),
@@ -56,8 +56,9 @@ gr.Interface(
56
  outputs=[gr.Textbox(placeholder="Message..."), gr.Dataframe()],
57
  examples=examples,
58
  live=False,
59
- ).launch(share=True)
60
 
 
61
 
62
  # gr.Interface(
63
  # predict,
 
32
  ["A giraffe at Lincoln Park Zoo"]
33
  ]
34
 
35
+ def main(sentence: str, score_type: str, threshold_cosine: float, threshold_jaccard: float = 0.1):
36
  threshold = threshold_cosine if score_type == "cosine" else threshold_jaccard
37
  results = search_offers(sentence, df_offers_brand_retailer, category_dict, brand_belong_category_dict, score_type, threshold)
38
  message, processed_results = process_output(results)
 
45
  else:
46
  return "We found some great offers!", output
47
 
48
+ demo = gr.Interface(
49
  fn=main,
50
  inputs=[
51
  gr.Textbox(lines=1, placeholder="Type here..."),
 
56
  outputs=[gr.Textbox(placeholder="Message..."), gr.Dataframe()],
57
  examples=examples,
58
  live=False,
59
+ )
60
 
61
+ demo.launch(share=True)
62
 
63
  # gr.Interface(
64
  # predict,