Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -954,7 +954,7 @@ def fetch_local_events():
|
|
954 |
url = f'https://serpapi.com/search.json?engine=google_events&q=Events+in+Omaha&hl=en&gl=us&api_key={api_key}'
|
955 |
|
956 |
response = requests.get(url)
|
957 |
-
if response.status_code == 200
|
958 |
events_results = response.json().get("events_results", [])
|
959 |
events_html = """
|
960 |
<h2 style="font-family: 'Georgia', serif; color: #ff0000; background-color: #f8f8f8; padding: 10px; border-radius: 10px;">Local Events</h2>
|
@@ -1213,7 +1213,7 @@ def fetch_local_news():
|
|
1213 |
api_key = os.environ['SERP_API']
|
1214 |
url = f'https://serpapi.com/search.json?engine=google_news&q=omaha headline&api_key={api_key}'
|
1215 |
response = requests.get(url)
|
1216 |
-
if response.status_code == 200
|
1217 |
results = response.json().get("news_results", [])
|
1218 |
news_html = """
|
1219 |
<h2 style="font-family: 'Georgia', serif; color: #ff0000; background-color: #f8f8f8; padding: 10px; border-radius: 10px;">Omaha Today</h2>
|
@@ -1335,7 +1335,7 @@ def show_map_if_details(history,choice):
|
|
1335 |
if choice in ["Details", "Conversational"]:
|
1336 |
return gr.update(visible=True), update_map_with_response(history)
|
1337 |
else:
|
1338 |
-
return gr.update(visible
|
1339 |
|
1340 |
def generate_audio_elevenlabs(text):
|
1341 |
XI_API_KEY = os.environ['ELEVENLABS_API']
|
@@ -1444,7 +1444,7 @@ def toggle_login_signup(show_login):
|
|
1444 |
if show_login:
|
1445 |
return gr.update(visible=True), gr.update(visible=False)
|
1446 |
else:
|
1447 |
-
return gr.update(visible=False), gr.update(visible
|
1448 |
|
1449 |
def toggle_login_logout(is_logged_in):
|
1450 |
if is_logged_in:
|
@@ -1512,7 +1512,7 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1512 |
login_form_button.click(fn=login, inputs=[login_username, login_password], outputs=[login_message, login_form, signup_button]).then(
|
1513 |
fn=lambda: (gr.update(visible=False), gr.update(visible=False), gr.update(value="Logout")), inputs=None, outputs=[login_form, signup_form, login_button]
|
1514 |
)
|
1515 |
-
gr.Button("Close").click(fn=lambda: gr.update(visible
|
1516 |
login_button.click(fn=toggle_login_signup, inputs=[gr.State(True)], outputs=[login_form, signup_form])
|
1517 |
|
1518 |
signup_form = gr.Column(visible=False)
|
@@ -1524,7 +1524,7 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1524 |
signup_form_button = gr.Button("Signup")
|
1525 |
signup_message = gr.Textbox(interactive=False)
|
1526 |
signup_form_button.click(fn=signup, inputs=[signup_username, signup_password, signup_password_confirmation], outputs=[signup_message, signup_form, signup_button]).then(
|
1527 |
-
fn=lambda: gr.update(visible
|
1528 |
)
|
1529 |
gr.Button("Close").click(fn=lambda: gr.update(visible=False), inputs=None, outputs=signup_form)
|
1530 |
signup_button.click(fn=toggle_login_signup, inputs=[gr.State(False)], outputs=[signup_form, login_form])
|
|
|
954 |
url = f'https://serpapi.com/search.json?engine=google_events&q=Events+in+Omaha&hl=en&gl=us&api_key={api_key}'
|
955 |
|
956 |
response = requests.get(url)
|
957 |
+
if response.status_code == 200) {
|
958 |
events_results = response.json().get("events_results", [])
|
959 |
events_html = """
|
960 |
<h2 style="font-family: 'Georgia', serif; color: #ff0000; background-color: #f8f8f8; padding: 10px; border-radius: 10px;">Local Events</h2>
|
|
|
1213 |
api_key = os.environ['SERP_API']
|
1214 |
url = f'https://serpapi.com/search.json?engine=google_news&q=omaha headline&api_key={api_key}'
|
1215 |
response = requests.get(url)
|
1216 |
+
if response.status_code == 200) {
|
1217 |
results = response.json().get("news_results", [])
|
1218 |
news_html = """
|
1219 |
<h2 style="font-family: 'Georgia', serif; color: #ff0000; background-color: #f8f8f8; padding: 10px; border-radius: 10px;">Omaha Today</h2>
|
|
|
1335 |
if choice in ["Details", "Conversational"]:
|
1336 |
return gr.update(visible=True), update_map_with_response(history)
|
1337 |
else:
|
1338 |
+
return gr.update(visible(False), "")
|
1339 |
|
1340 |
def generate_audio_elevenlabs(text):
|
1341 |
XI_API_KEY = os.environ['ELEVENLABS_API']
|
|
|
1444 |
if show_login:
|
1445 |
return gr.update(visible=True), gr.update(visible=False)
|
1446 |
else:
|
1447 |
+
return gr.update(visible=False), gr.update(visible(True))
|
1448 |
|
1449 |
def toggle_login_logout(is_logged_in):
|
1450 |
if is_logged_in:
|
|
|
1512 |
login_form_button.click(fn=login, inputs=[login_username, login_password], outputs=[login_message, login_form, signup_button]).then(
|
1513 |
fn=lambda: (gr.update(visible=False), gr.update(visible=False), gr.update(value="Logout")), inputs=None, outputs=[login_form, signup_form, login_button]
|
1514 |
)
|
1515 |
+
gr.Button("Close").click(fn=lambda: gr.update(visible(False)), inputs=None, outputs=login_form)
|
1516 |
login_button.click(fn=toggle_login_signup, inputs=[gr.State(True)], outputs=[login_form, signup_form])
|
1517 |
|
1518 |
signup_form = gr.Column(visible=False)
|
|
|
1524 |
signup_form_button = gr.Button("Signup")
|
1525 |
signup_message = gr.Textbox(interactive=False)
|
1526 |
signup_form_button.click(fn=signup, inputs=[signup_username, signup_password, signup_password_confirmation], outputs=[signup_message, signup_form, signup_button]).then(
|
1527 |
+
fn=lambda: gr.update(visible(False)), inputs=None, outputs=signup_form
|
1528 |
)
|
1529 |
gr.Button("Close").click(fn=lambda: gr.update(visible=False), inputs=None, outputs=signup_form)
|
1530 |
signup_button.click(fn=toggle_login_signup, inputs=[gr.State(False)], outputs=[signup_form, login_form])
|