Ouiam123 commited on
Commit
4ec44a3
·
verified ·
1 Parent(s): ce5c6e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,10 +1,16 @@
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
 
 
 
 
 
 
3
 
4
  # Load your model
5
  model_name = "Ouiam123/Llama-2-7b-chat-finetune-tourism"
6
- tokenizer = AutoTokenizer.from_pretrained(model_name)
7
- model = AutoModelForCausalLM.from_pretrained(model_name)
8
 
9
  # Define the response generation function
10
  def generate_response(prompt):
 
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
+ from huggingface_hub import login
4
+ import os
5
+
6
+ # Authenticate with Hugging Face
7
+ HF_API_TOKEN = os.getenv("ttt")
8
+ login(HF_API_TOKEN)
9
 
10
  # Load your model
11
  model_name = "Ouiam123/Llama-2-7b-chat-finetune-tourism"
12
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=HF_API_TOKEN)
13
+ model = AutoModelForCausalLM.from_pretrained(model_name, use_auth_token=HF_API_TOKEN)
14
 
15
  # Define the response generation function
16
  def generate_response(prompt):