Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from text_generation import Client # Assuming you have a text_generation module
|
|
5 |
from transformers import AutoModel
|
6 |
|
7 |
# Set Hugging Face API token from environment variable
|
8 |
-
HF_TOKEN = os.environ.get('
|
9 |
|
10 |
if not HF_TOKEN:
|
11 |
raise ValueError("Hugging Face API token is not set. Set the HF_READ_TOKEN environment variable.")
|
@@ -18,6 +18,10 @@ access_token = os.environ.get('HF_MODEL_ACCESS_TOKEN', False)
|
|
18 |
if not access_token:
|
19 |
raise ValueError("Hugging Face model access token is not set. Set the HF_MODEL_ACCESS_TOKEN environment variable.")
|
20 |
|
|
|
|
|
|
|
|
|
21 |
model = AutoModel.from_pretrained("private/model", token=access_token)
|
22 |
|
23 |
def get_prompt(message, chat_history, system_prompt):
|
|
|
5 |
from transformers import AutoModel
|
6 |
|
7 |
# Set Hugging Face API token from environment variable
|
8 |
+
HF_TOKEN = os.environ.get('chatbot', False)
|
9 |
|
10 |
if not HF_TOKEN:
|
11 |
raise ValueError("Hugging Face API token is not set. Set the HF_READ_TOKEN environment variable.")
|
|
|
18 |
if not access_token:
|
19 |
raise ValueError("Hugging Face model access token is not set. Set the HF_MODEL_ACCESS_TOKEN environment variable.")
|
20 |
|
21 |
+
# Set protected namespaces to resolve the warning
|
22 |
+
model_config = AutoModel.config
|
23 |
+
model_config['protected_namespaces'] = ()
|
24 |
+
|
25 |
model = AutoModel.from_pretrained("private/model", token=access_token)
|
26 |
|
27 |
def get_prompt(message, chat_history, system_prompt):
|