tx3bas commited on
Commit
b549dc1
verified
1 Parent(s): 94501c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -58,7 +58,7 @@ def fetch_youtube_suggestions(query, lang_code="es"):
58
  return []
59
 
60
  # Funci贸n para obtener sugerencias de Bing
61
- def fetch_bing_suggestions(query, market="es-ES"):
62
  url = "https://api.bing.com/qsml.aspx"
63
  params = {
64
  "Market": market,
@@ -88,7 +88,7 @@ def fetch_bing_suggestions(query, market="es-ES"):
88
  return []
89
 
90
  # Funci贸n para obtener sugerencias de Amazon
91
- def fetch_amazon_suggestions(query, market_id="A1RKKUPIHCS9HS", alias="aps"):
92
  url = "https://completion.amazon.com/api/2017/suggestions"
93
  params = {
94
  "mid": market_id,
@@ -188,6 +188,12 @@ def main(keyword):
188
  combined_top_10_suggestions = [sug for sug, freq in sorted_suggestions if freq >= 2][:10]
189
  suggestions_str = ", ".join(combined_top_10_suggestions)
190
 
 
 
 
 
 
 
191
  # Crear el HTML de salida con un bot贸n de copia
192
  html_output = f"""
193
  <div>
@@ -235,6 +241,12 @@ def main(keyword):
235
  html_output += f"<li>{suggestion}</li>"
236
  html_output += "</ul>"
237
 
 
 
 
 
 
 
238
  return html_output
239
 
240
  # Interfaz de Gradio
 
58
  return []
59
 
60
  # Funci贸n para obtener sugerencias de Bing
61
+ def fetch_bing_suggestions(query, market="en-US"):
62
  url = "https://api.bing.com/qsml.aspx"
63
  params = {
64
  "Market": market,
 
88
  return []
89
 
90
  # Funci贸n para obtener sugerencias de Amazon
91
+ def fetch_amazon_suggestions(query, market_id="ATVPDKIKX0DER", alias="aps"):
92
  url = "https://completion.amazon.com/api/2017/suggestions"
93
  params = {
94
  "mid": market_id,
 
188
  combined_top_10_suggestions = [sug for sug, freq in sorted_suggestions if freq >= 2][:10]
189
  suggestions_str = ", ".join(combined_top_10_suggestions)
190
 
191
+ # Crear la lista de todas las palabras clave con su n煤mero de repeticiones
192
+ all_suggestions_str = "<ul>"
193
+ for suggestion, freq in sorted_suggestions:
194
+ all_suggestions_str += f"<li>{suggestion} - {freq} repeticiones</li>"
195
+ all_suggestions_str += "</ul>"
196
+
197
  # Crear el HTML de salida con un bot贸n de copia
198
  html_output = f"""
199
  <div>
 
241
  html_output += f"<li>{suggestion}</li>"
242
  html_output += "</ul>"
243
 
244
+ # Agregar la lista completa de todas las palabras clave
245
+ html_output += """
246
+ <h4>Lista completa de palabras clave con su n煤mero de repeticiones:</h4>
247
+ """
248
+ html_output += all_suggestions_str
249
+
250
  return html_output
251
 
252
  # Interfaz de Gradio