eabybabu commited on
Commit
b79c2cd
·
1 Parent(s): 77f2591

Use Hugging Face Secrets for API token

Browse files
Files changed (2) hide show
  1. .gitignore +1 -0
  2. app.py +6 -6
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ ".env"
app.py CHANGED
@@ -5,21 +5,21 @@ import os
5
 
6
 
7
  from dotenv import load_dotenv
8
- import os
9
 
10
- # ✅ Load API Token Securely from .env
11
- load_dotenv()
 
 
12
  HF_TOKEN = os.getenv("HF_TOKEN")
13
 
 
 
14
 
15
 
16
  # ✅ Load the trained chatbot model from Hugging Face
17
  MODEL_NAME = "eabybabu/chatbot_model" # Replace with your actual model name
18
 
19
 
20
- tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, token=HF_TOKEN)
21
- model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, token=HF_TOKEN)
22
-
23
 
24
  # ✅ Function to generate chatbot responses
25
  def chatbot_response(user_input):
 
5
 
6
 
7
  from dotenv import load_dotenv
 
8
 
9
+
10
+
11
+
12
+ # ✅ Load API Token Securely from Hugging Face Secrets
13
  HF_TOKEN = os.getenv("HF_TOKEN")
14
 
15
+ tokenizer = AutoTokenizer.from_pretrained("eabybabu/chatbot_model", token=HF_TOKEN)
16
+ model = AutoModelForCausalLM.from_pretrained("eabybabu/chatbot_model", token=HF_TOKEN)
17
 
18
 
19
  # ✅ Load the trained chatbot model from Hugging Face
20
  MODEL_NAME = "eabybabu/chatbot_model" # Replace with your actual model name
21
 
22
 
 
 
 
23
 
24
  # ✅ Function to generate chatbot responses
25
  def chatbot_response(user_input):