Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,6 +29,24 @@ def filtrar_malas_palabras(texto):
|
|
| 29 |
return True
|
| 30 |
return False
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# Funci贸n para obtener la respuesta del bot
|
| 33 |
def get_response(user_input):
|
| 34 |
# Comportamiento general
|
|
|
|
| 29 |
return True
|
| 30 |
return False
|
| 31 |
|
| 32 |
+
import wikipedia
|
| 33 |
+
|
| 34 |
+
# Configura el idioma de Wikipedia
|
| 35 |
+
wikipedia.set_lang("es") # Espa帽ol
|
| 36 |
+
|
| 37 |
+
def get_species_info():
|
| 38 |
+
try:
|
| 39 |
+
# Realiza una b煤squeda y obt茅n un resumen
|
| 40 |
+
summary = wikipedia.summary("Jard铆n Bot谩nico Nacional de Vi帽a del Mar", sentences=2)
|
| 41 |
+
return summary
|
| 42 |
+
except wikipedia.exceptions.DisambiguationError as e:
|
| 43 |
+
return "Hay muchos temas relacionados. Por favor, especifica m谩s tu b煤squeda."
|
| 44 |
+
except wikipedia.exceptions.PageError:
|
| 45 |
+
return "No encontr茅 informaci贸n sobre ese tema en mis sistemas, lo siento."
|
| 46 |
+
except Exception as e:
|
| 47 |
+
return "Lo siento, ocurri贸 un error al buscar la informaci贸n."
|
| 48 |
+
|
| 49 |
+
|
| 50 |
# Funci贸n para obtener la respuesta del bot
|
| 51 |
def get_response(user_input):
|
| 52 |
# Comportamiento general
|