Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,6 +25,23 @@ from langchain.chains.conversation.memory import ConversationBufferWindowMemory
|
|
25 |
from langchain.agents import Tool, initialize_agent
|
26 |
from huggingface_hub import login
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# Flask app for authentication
|
29 |
auth_app = Flask(__name__)
|
30 |
auth_app.secret_key = os.urandom(24)
|
@@ -73,21 +90,6 @@ def check_auth():
|
|
73 |
|
74 |
|
75 |
|
76 |
-
# Check if the token is already set in the environment variables
|
77 |
-
hf_token = os.getenv("HF_TOKEN")
|
78 |
-
|
79 |
-
if hf_token is None:
|
80 |
-
# If the token is not set, prompt for it (this should be done securely)
|
81 |
-
print("Please set your Hugging Face token in the environment variables.")
|
82 |
-
else:
|
83 |
-
# Login using the token
|
84 |
-
login(token=hf_token)
|
85 |
-
|
86 |
-
# Your application logic goes here
|
87 |
-
print("Logged in successfully to Hugging Face Hub!")
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
# Set up logging
|
92 |
logging.basicConfig(level=logging.DEBUG)
|
93 |
|
|
|
25 |
from langchain.agents import Tool, initialize_agent
|
26 |
from huggingface_hub import login
|
27 |
|
28 |
+
# Check if the token is already set in the environment variables
|
29 |
+
hf_token = os.getenv("HF_TOKEN")
|
30 |
+
|
31 |
+
if hf_token is None:
|
32 |
+
# If the token is not set, prompt for it (this should be done securely)
|
33 |
+
print("Please set your Hugging Face token in the environment variables.")
|
34 |
+
else:
|
35 |
+
# Login using the token
|
36 |
+
login(token=hf_token)
|
37 |
+
|
38 |
+
# Your application logic goes here
|
39 |
+
print("Logged in successfully to Hugging Face Hub!")
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
# Flask app for authentication
|
46 |
auth_app = Flask(__name__)
|
47 |
auth_app.secret_key = os.urandom(24)
|
|
|
90 |
|
91 |
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
# Set up logging
|
94 |
logging.basicConfig(level=logging.DEBUG)
|
95 |
|