tx3bas commited on
Commit
2f704d7
verified
1 Parent(s): c8d5cd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -55,6 +55,7 @@ def buscar_google(query, dominio, hl='es', num_results=100):
55
 
56
  table_html += "</table></details>"
57
 
 
58
  mensaje = ""
59
  if len(posiciones_dominio) > 1 and 1 in posiciones_dominio:
60
  mensaje = f"Parasitaci贸n SEO: {url_objetivo} se encuentra en las posiciones {posiciones_dominio} 馃"
@@ -67,16 +68,20 @@ def buscar_google(query, dominio, hl='es', num_results=100):
67
  else:
68
  mensaje = f"{url_objetivo} no se encuentra en el top 100 馃槙"
69
 
70
- return mensaje, table_html
 
 
 
 
 
71
 
72
  def canibalizacion_interface(url, keyword):
73
- mensaje, tabla = buscar_google(keyword, url)
74
- return f"Posici贸n:\n<br>{mensaje}", tabla
75
 
76
  iface = gr.Interface(
77
  fn=canibalizacion_interface,
78
  inputs=["text", "text"],
79
- outputs=["text", "html"],
80
  title="Buscador de Canibalizaciones en Google",
81
  description="Encuentra posibles canibalizaciones y parasitaciones en Google a partir de una URL y una palabra clave.",
82
  article="<p style='text-align:center !important;'>Desarrollada por <a style='text-decoration:none !important;color:#e12a31 !important;' href='https://artxeweb.com'>漏 Artxe Web</a></p>"
 
55
 
56
  table_html += "</table></details>"
57
 
58
+ # Construcci贸n del mensaje y la tabla HTML
59
  mensaje = ""
60
  if len(posiciones_dominio) > 1 and 1 in posiciones_dominio:
61
  mensaje = f"Parasitaci贸n SEO: {url_objetivo} se encuentra en las posiciones {posiciones_dominio} 馃"
 
68
  else:
69
  mensaje = f"{url_objetivo} no se encuentra en el top 100 馃槙"
70
 
71
+ html_output = f"<div><b>{mensaje}</b></div>"
72
+ html_output += "<details style='padding: 10px; background: #f3f3f3; border: solid 0; border-radius: 8px; margin-top: 10px;'><summary>Ver Resultados</summary>"
73
+ html_output += table_html
74
+ html_output += "</details>"
75
+
76
+ return html_output
77
 
78
  def canibalizacion_interface(url, keyword):
79
+ return buscar_google(keyword, url)
 
80
 
81
  iface = gr.Interface(
82
  fn=canibalizacion_interface,
83
  inputs=["text", "text"],
84
+ outputs="html",
85
  title="Buscador de Canibalizaciones en Google",
86
  description="Encuentra posibles canibalizaciones y parasitaciones en Google a partir de una URL y una palabra clave.",
87
  article="<p style='text-align:center !important;'>Desarrollada por <a style='text-decoration:none !important;color:#e12a31 !important;' href='https://artxeweb.com'>漏 Artxe Web</a></p>"