avacaondata commited on
Commit
e8df03b
1 Parent(s): 4af649e

añadidos examples y mejorada app

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. article_app.py +12 -0
app.py CHANGED
@@ -117,7 +117,7 @@ def sort_on_similarity(question, contexts, include_rank: int = 5):
117
  ]
118
  text_pairs = [[question, ctx] for ctx in contexts]
119
  similarity_scores = crossencoder.predict(text_pairs)
120
- similarity_scores = sim_scores_ss * similarity_scores
121
  similarity_ranking_idx = np.flip(np.argsort(similarity_scores))
122
  return [contexts[idx] for idx in similarity_ranking_idx][:include_rank]
123
 
@@ -174,7 +174,7 @@ def search_and_answer(
174
  )
175
  print(f"Transcripted question: *** {question} ****")
176
  if any([any([term in word.lower() for term in covidterms]) for word in question.split(" ")]):
177
- return "Del COVID no queremos saber ya más nada, lo sentimos, pregúntame sobre otra cosa :P ", "ni contexto ni contexta.", "tmptdsnrh_8.flac"
178
  contexts = query_index(question)
179
  contexts = sort_on_similarity(question, contexts)
180
  context = create_context(contexts)
 
117
  ]
118
  text_pairs = [[question, ctx] for ctx in contexts]
119
  similarity_scores = crossencoder.predict(text_pairs)
120
+ similarity_scores = np.array(sim_scores_ss) * similarity_scores
121
  similarity_ranking_idx = np.flip(np.argsort(similarity_scores))
122
  return [contexts[idx] for idx in similarity_ranking_idx][:include_rank]
123
 
 
174
  )
175
  print(f"Transcripted question: *** {question} ****")
176
  if any([any([term in word.lower() for term in covidterms]) for word in question.split(" ")]):
177
+ return "Del COVID no queremos saber ya más nada, lo sentimos, pregúntame sobre otra cosa :P ", "ni contexto ni contexta.", "audio_troll.flac"
178
  contexts = query_index(question)
179
  contexts = sort_on_similarity(question, contexts)
180
  context = create_context(contexts)
article_app.py CHANGED
@@ -86,6 +86,18 @@ examples = [
86
  "wav2vec2-iic",
87
  False,
88
  ],
 
 
 
 
 
 
 
 
 
 
 
 
89
  [
90
  "¿Qué es la tecnología CRISPR?",
91
  "vacio.flac",
 
86
  "wav2vec2-iic",
87
  False,
88
  ],
89
+ [
90
+ "¿Qué es la gripe aviar?",
91
+ "vacio.flac",
92
+ "vacio.flac",
93
+ 50,
94
+ 8,
95
+ 3,
96
+ 1.0,
97
+ 250,
98
+ "wav2vec2-iic",
99
+ False,
100
+ ],
101
  [
102
  "¿Qué es la tecnología CRISPR?",
103
  "vacio.flac",