Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -341,20 +341,6 @@ def generate_answer(message, choice):
|
|
341 |
return response['output'], addresses
|
342 |
|
343 |
|
344 |
-
# def extract_location_from_response(response):
|
345 |
-
# agent = initialize_agent_with_prompt(QA_CHAIN_PROMPT_1)
|
346 |
-
# address_response = agent(response)
|
347 |
-
# return address_response['output']
|
348 |
-
|
349 |
-
def extract_location_from_response(response):
|
350 |
-
address_prompt = PromptTemplate(
|
351 |
-
input_variables=["context", "question"],
|
352 |
-
template="Extract the address from the following response:\n{context}\nResponse: {question}"
|
353 |
-
)
|
354 |
-
agent = initialize_agent_with_prompt(address_prompt)
|
355 |
-
address_response = agent(response)
|
356 |
-
return address_response['output']
|
357 |
-
|
358 |
|
359 |
def bot(history, choice):
|
360 |
if not history:
|
@@ -373,16 +359,6 @@ def bot(history, choice):
|
|
373 |
|
374 |
audio_path = audio_future.result()
|
375 |
yield history, audio_path
|
376 |
-
if choice == "Conversational":
|
377 |
-
address_response = extract_location_from_response(response)
|
378 |
-
addresses = extract_addresses(address_response)
|
379 |
-
map_html = generate_map(addresses)
|
380 |
-
yield history, map_html
|
381 |
-
|
382 |
-
from datetime import datetime
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
|
387 |
def add_message(history, message):
|
388 |
history.append((message, None))
|
|
|
341 |
return response['output'], addresses
|
342 |
|
343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
|
345 |
def bot(history, choice):
|
346 |
if not history:
|
|
|
359 |
|
360 |
audio_path = audio_future.result()
|
361 |
yield history, audio_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
|
363 |
def add_message(history, message):
|
364 |
history.append((message, None))
|