hellopahe commited on
Commit
7090141
1 Parent(s): 5170bd0
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -100,7 +100,7 @@ lex = LexRank()
100
  def randeng_extract(content):
101
  summary_length = math.ceil(len(content) / 10)
102
  sentences = lex.find_central(content, num=summary_length)
103
- output = "原文: \n"
104
  for index, sentence in enumerate(sentences):
105
  output += f"{index}: {sentence}\n"
106
  # output += "摘要:\n"
@@ -135,9 +135,9 @@ def similarity_search(queries, doc):
135
  top_results = torch.topk(cos_scores, k=top_k)
136
  output += "\n\n======================\n\n"
137
  output += f"Query: {query}"
138
- output += "\nTop 5 most similar sentences in corpus:"
139
  for score, idx in zip(top_results[0], top_results[1]):
140
- output += f"{doc_list[idx]}(Score: {score})"
141
  return output
142
 
143
 
@@ -154,8 +154,8 @@ with gr.Blocks() as app:
154
  # text_button = gr.Button("生成摘要")
155
  with gr.Tab("相似度检测"):
156
  with gr.Row():
157
- text_input_query = gr.Textbox(label="查询文本")
158
- text_input_doc = gr.Textbox(lines=10, label="逐行输入待比较的文本列表")
159
  text_button_similarity = gr.Button("对比相似度")
160
  text_output_similarity = gr.Textbox()
161
 
 
100
  def randeng_extract(content):
101
  summary_length = math.ceil(len(content) / 10)
102
  sentences = lex.find_central(content, num=summary_length)
103
+ output = ""
104
  for index, sentence in enumerate(sentences):
105
  output += f"{index}: {sentence}\n"
106
  # output += "摘要:\n"
 
135
  top_results = torch.topk(cos_scores, k=top_k)
136
  output += "\n\n======================\n\n"
137
  output += f"Query: {query}"
138
+ output += "\nTop 5 most similar sentences in corpus:\n"
139
  for score, idx in zip(top_results[0], top_results[1]):
140
+ output += f"{doc_list[idx]}(Score: {score})\n"
141
  return output
142
 
143
 
 
154
  # text_button = gr.Button("生成摘要")
155
  with gr.Tab("相似度检测"):
156
  with gr.Row():
157
+ text_input_query = gr.Textbox(lines=10, label="查询文本")
158
+ text_input_doc = gr.Textbox(lines=20, label="逐行输入待比较的文本列表")
159
  text_button_similarity = gr.Button("对比相似度")
160
  text_output_similarity = gr.Textbox()
161