Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -903,7 +903,7 @@ from langchain.agents import Tool, initialize_agent
|
|
903 |
from huggingface_hub import login
|
904 |
|
905 |
import sqlite3
|
906 |
-
from passlib.hash import bcrypt
|
907 |
|
908 |
# Check if the token is already set in the environment variables
|
909 |
hf_token = os.getenv("HF_TOKEN")
|
@@ -1209,7 +1209,6 @@ def generate_map(location_names):
|
|
1209 |
map_html = m._repr_html_()
|
1210 |
return map_html
|
1211 |
|
1212 |
-
|
1213 |
def fetch_local_news():
|
1214 |
api_key = os.environ['SERP_API']
|
1215 |
url = f'https://serpapi.com/search.json?engine=google_news&q=omaha headline&api_key={api_key}'
|
@@ -1336,7 +1335,7 @@ def show_map_if_details(history,choice):
|
|
1336 |
if choice in ["Details", "Conversational"]:
|
1337 |
return gr.update(visible=True), update_map_with_response(history)
|
1338 |
else:
|
1339 |
-
return gr.update(visible
|
1340 |
|
1341 |
def generate_audio_elevenlabs(text):
|
1342 |
XI_API_KEY = os.environ['ELEVENLABS_API']
|
@@ -1441,7 +1440,25 @@ def signup(username, password, password_confirmation):
|
|
1441 |
def login(username, password):
|
1442 |
return login_user(username, password)
|
1443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1444 |
with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
1445 |
with gr.Row():
|
1446 |
with gr.Column():
|
1447 |
state = gr.State()
|
@@ -1506,10 +1523,6 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1506 |
signup_form_button.click(fn=signup, inputs=[signup_username, signup_password, signup_password_confirmation], outputs=[signup_message])
|
1507 |
signup_button.click(fn=toggle_login_signup, inputs=[gr.State(False)], outputs=[signup_form, gr.Column(visible=False)])
|
1508 |
|
1509 |
-
def toggle_login_status(is_logged_in):
|
1510 |
-
is_logged_in = not is_logged_in
|
1511 |
-
return gr.update(value=toggle_login_logout(is_logged_in)), is_logged_in
|
1512 |
-
|
1513 |
login_form_button.click(fn=toggle_login_status, inputs=[is_logged_in], outputs=[login_button, is_logged_in])
|
1514 |
login_button.click(fn=toggle_login_status, inputs=[is_logged_in], outputs=[login_button, is_logged_in])
|
1515 |
|
|
|
903 |
from huggingface_hub import login
|
904 |
|
905 |
import sqlite3
|
906 |
+
from passlib.hash import bcrypt # Ensure passlib is installed: pip install passlib
|
907 |
|
908 |
# Check if the token is already set in the environment variables
|
909 |
hf_token = os.getenv("HF_TOKEN")
|
|
|
1209 |
map_html = m._repr_html_()
|
1210 |
return map_html
|
1211 |
|
|
|
1212 |
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}'
|
|
|
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']
|
|
|
1440 |
def login(username, password):
|
1441 |
return login_user(username, password)
|
1442 |
|
1443 |
+
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=True)
|
1448 |
+
|
1449 |
+
def toggle_login_logout(is_logged_in):
|
1450 |
+
if is_logged_in:
|
1451 |
+
return "Logout"
|
1452 |
+
else:
|
1453 |
+
return "Login"
|
1454 |
+
|
1455 |
with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
1456 |
+
is_logged_in = gr.State(False)
|
1457 |
+
|
1458 |
+
def toggle_login_status(is_logged_in):
|
1459 |
+
is_logged_in = not is_logged_in
|
1460 |
+
return gr.update(value=toggle_login_logout(is_logged_in)), is_logged_in
|
1461 |
+
|
1462 |
with gr.Row():
|
1463 |
with gr.Column():
|
1464 |
state = gr.State()
|
|
|
1523 |
signup_form_button.click(fn=signup, inputs=[signup_username, signup_password, signup_password_confirmation], outputs=[signup_message])
|
1524 |
signup_button.click(fn=toggle_login_signup, inputs=[gr.State(False)], outputs=[signup_form, gr.Column(visible=False)])
|
1525 |
|
|
|
|
|
|
|
|
|
1526 |
login_form_button.click(fn=toggle_login_status, inputs=[is_logged_in], outputs=[login_button, is_logged_in])
|
1527 |
login_button.click(fn=toggle_login_status, inputs=[is_logged_in], outputs=[login_button, is_logged_in])
|
1528 |
|