Arhashmi commited on
Commit
d9a4882
·
1 Parent(s): 8f180e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -4,15 +4,20 @@ import gradio as gr
4
  from text_generation import Client # Assuming you have a text_generation module
5
  from transformers import AutoModel
6
 
7
- # Set Hugging Face API token
8
- os.environ['HF_READ_TOKEN'] = "your_actual_token_here" # Replace with your Hugging Face API token
9
-
10
  HF_TOKEN = os.environ.get('HF_READ_TOKEN', False)
 
 
 
 
11
  EOS_STRING = '</s>'
12
  EOT_STRING = '<EOT>'
13
 
14
  # Load the private model with access token
15
- access_token = "hf_..." # Replace with your actual access token
 
 
 
16
  model = AutoModel.from_pretrained("private/model", token=access_token)
17
 
18
  def get_prompt(message, chat_history, system_prompt):
 
4
  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('HF_READ_TOKEN', False)
9
+
10
+ if not HF_TOKEN:
11
+ raise ValueError("Hugging Face API token is not set. Set the HF_READ_TOKEN environment variable.")
12
+
13
  EOS_STRING = '</s>'
14
  EOT_STRING = '<EOT>'
15
 
16
  # Load the private model with access token
17
+ 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):