PierreBrunelle commited on
Commit
4b9f9bd
1 Parent(s): 24ba443

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -110,10 +110,7 @@ def similarity_search(query, num_results, progress=gr.Progress()):
110
  progress(0.5, desc="Performing search...")
111
 
112
  sim = sentences_view.text.similarity(query)
113
- results = sentences_view.order_by(sim, asc=False).limit(num_results).select(sentences_view.text, sim=sim).collect().to_pandas()
114
-
115
- # Format similarity scores as percentages
116
- results['sim'] = results['sim'].apply(lambda x: f"{x*100:.2f}%")
117
 
118
  progress(1.0, desc="Search complete")
119
  return results
@@ -228,7 +225,7 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
228
  num_results = gr.Slider(minimum=1, maximum=20, value=5, step=1, label="Number of Results")
229
  similarity_search_btn = gr.Button("Search", variant="secondary")
230
  similarity_results = gr.DataFrame(
231
- headers=["Relevant Text", "Similarity Score"],
232
  label="Search Results",
233
  wrap=True
234
  )
 
110
  progress(0.5, desc="Performing search...")
111
 
112
  sim = sentences_view.text.similarity(query)
113
+ results = sentences_view.order_by(sim, asc=False).limit(num_results).select(sentences_view.text).collect().to_pandas()
 
 
 
114
 
115
  progress(1.0, desc="Search complete")
116
  return results
 
225
  num_results = gr.Slider(minimum=1, maximum=20, value=5, step=1, label="Number of Results")
226
  similarity_search_btn = gr.Button("Search", variant="secondary")
227
  similarity_results = gr.DataFrame(
228
+ headers=["Relevant Text"],
229
  label="Search Results",
230
  wrap=True
231
  )