Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -124,6 +124,8 @@ def print_like_dislike(x: gr.LikeData):
|
|
124 |
|
125 |
# Function to extract addresses from the chatbot's response
|
126 |
def extract_addresses(response):
|
|
|
|
|
127 |
address_pattern_1 = r'([A-Z].*,\sOmaha,\sNE\s\d{5})'
|
128 |
address_pattern_2 = r'(\d{4}\s.*,\sOmaha,\sNE\s\d{5})'
|
129 |
address_pattern_3 = r'([A-Z].*,\sNE\s\d{5})'
|
@@ -455,7 +457,8 @@ def show_map_if_details(history,choice):
|
|
455 |
if choice in ["Details", "Conversational"]:
|
456 |
return gr.update(visible=True), update_map_with_response(history)
|
457 |
else:
|
458 |
-
return gr.update(visible=False), ""
|
|
|
459 |
|
460 |
def generate_audio_elevenlabs(text):
|
461 |
XI_API_KEY = os.environ['ELEVENLABS_API']
|
|
|
124 |
|
125 |
# Function to extract addresses from the chatbot's response
|
126 |
def extract_addresses(response):
|
127 |
+
if not isinstance(response, str):
|
128 |
+
response = str(response)
|
129 |
address_pattern_1 = r'([A-Z].*,\sOmaha,\sNE\s\d{5})'
|
130 |
address_pattern_2 = r'(\d{4}\s.*,\sOmaha,\sNE\s\d{5})'
|
131 |
address_pattern_3 = r'([A-Z].*,\sNE\s\d{5})'
|
|
|
457 |
if choice in ["Details", "Conversational"]:
|
458 |
return gr.update(visible=True), update_map_with_response(history)
|
459 |
else:
|
460 |
+
#return gr.update(visible=False), ""
|
461 |
+
return gr.update(visible(False), "")
|
462 |
|
463 |
def generate_audio_elevenlabs(text):
|
464 |
XI_API_KEY = os.environ['ELEVENLABS_API']
|