simonschoe commited on
Commit
b06fb6c
β€’
1 Parent(s): f746c89

update examples

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -68,13 +68,19 @@ with app:
68
  The model allows for two use cases:
69
  1. *Single Search:* The input query consists of a single word. When provided a bi-, tri-, or even fourgram, the quality of the model output depends on the presence of the query token in the model's vocabulary. N-grams should be concated by an underscore (e.g., "machine_learning" or "artifical_intelligence").
70
  2. *Multi Search:* The input query may consist of several words or n-grams, seperated by comma, semi-colon or newline. It then computes the average vector over all inputs and performs semantic search based on the average input token.
71
-
72
- #### Examples
73
- - transformation
74
- - climate_change
75
- - risk, political_risk, uncertainty
76
  """
77
  )
 
 
 
 
 
 
 
 
 
 
 
78
  with gr.Column():
79
  text_in = gr.Textbox(lines=1, placeholder="Insert text", label="Search Query")
80
  with gr.Row():
@@ -82,13 +88,7 @@ with app:
82
  compute_bt = gr.Button("Search")
83
  df_out = gr.Dataframe(interactive=False)
84
  f_out = gr.File(interactive=False, label="Download")
85
- gr.Examples(
86
- examples = [["transformation", 3], ["climate_change", 3], ["risk, political_risk, uncertainty", 5]],
87
- inputs = [text_in, n],
88
- outputs = [df_out, f_out, text_in],
89
- fn = semantic_search,
90
- cache_examples=True
91
- )
92
  gr.Markdown(
93
  """
94
  <p style="text-align: center;">
 
68
  The model allows for two use cases:
69
  1. *Single Search:* The input query consists of a single word. When provided a bi-, tri-, or even fourgram, the quality of the model output depends on the presence of the query token in the model's vocabulary. N-grams should be concated by an underscore (e.g., "machine_learning" or "artifical_intelligence").
70
  2. *Multi Search:* The input query may consist of several words or n-grams, seperated by comma, semi-colon or newline. It then computes the average vector over all inputs and performs semantic search based on the average input token.
 
 
 
 
 
71
  """
72
  )
73
+ gr.Examples(
74
+ examples = [
75
+ ["transformation", 20],
76
+ ["climate_change", 50],
77
+ ["risk, political_risk, uncertainty", 250],
78
+ ],
79
+ inputs = [text_in, n],
80
+ outputs = [df_out, f_out, text_in],
81
+ fn = semantic_search,
82
+ cache_examples=True
83
+ )
84
  with gr.Column():
85
  text_in = gr.Textbox(lines=1, placeholder="Insert text", label="Search Query")
86
  with gr.Row():
 
88
  compute_bt = gr.Button("Search")
89
  df_out = gr.Dataframe(interactive=False)
90
  f_out = gr.File(interactive=False, label="Download")
91
+
 
 
 
 
 
 
92
  gr.Markdown(
93
  """
94
  <p style="text-align: center;">