Zeitstaub commited on
Commit
f58eab9
1 Parent(s): d448711

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -45,7 +45,8 @@ def find_similar_texts(model_name, input_text):
45
  text_embeddings['euclidean_distance'] = distances
46
  sorted_embeddings = text_embeddings.sort_values(by='euclidean_distance', ascending=True)
47
  top_five = sorted_embeddings.head(5)[['abstract', 'patent no']]
48
- formatted_output = '\n\n'.join([f"Patent No: {row['patent no']}\nAbstract: {row['abstract']}\n" for index, row in top_five.iterrows()])
 
49
  return formatted_output
50
  else:
51
  return "It seems there is no patent abstract close to your description."
@@ -56,7 +57,7 @@ with gr.Blocks() as demo:
56
  with gr.Row():
57
  with gr.Column():
58
  model_selector = gr.Dropdown(choices=list(model_options.keys()), label="Chose Sentence-Transformer")
59
- text_input = gr.Textbox(lines=2, placeholder="machine learning for drug dosing", label="input_text (like <<machine learning for drug dosing>>. Remember, this is only a small selection of machine learning patents!)")
60
  submit_button = gr.Button("search")
61
 
62
  with gr.Column():
 
45
  text_embeddings['euclidean_distance'] = distances
46
  sorted_embeddings = text_embeddings.sort_values(by='euclidean_distance', ascending=True)
47
  top_five = sorted_embeddings.head(5)[['abstract', 'patent no']]
48
+ # formatted_output = '\n\n'.join([f"Patent No: {row['patent no']}\nAbstract: {row['abstract']}\n" for index, row in top_five.iterrows()])
49
+ formatted_output = '\n\n'.join([f"Patent No: {row['patent no']}\nTitle: {row['title']}\nAbstract: {row['abstract']}\n" for index, row in top_five.iterrows()])
50
  return formatted_output
51
  else:
52
  return "It seems there is no patent abstract close to your description."
 
57
  with gr.Row():
58
  with gr.Column():
59
  model_selector = gr.Dropdown(choices=list(model_options.keys()), label="Chose Sentence-Transformer")
60
+ text_input = gr.Textbox(lines=2, placeholder="machine learning for drug dosing", label="input_text (example: machine learning for drug dosing. Remember, this is only a small selection of machine learning patents!)")
61
  submit_button = gr.Button("search")
62
 
63
  with gr.Column():