noddysnots commited on
Commit
233f919
Β·
verified Β·
1 Parent(s): 816f539

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -2,9 +2,11 @@ import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
  import torch
4
 
5
- # πŸ”Ή Load Llama 3 - 7B model
6
- model_name = "meta-llama/Meta-Llama-3-7B-Instruct"
7
- tokenizer = AutoTokenizer.from_pretrained(model_name)
 
 
8
  model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
9
 
10
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=100)
@@ -41,7 +43,7 @@ demo = gr.Interface(
41
  fn=recommend_gifts,
42
  inputs="text",
43
  outputs="json",
44
- title="🎁 AI Gift Recommender (Llama 3 - 7B)",
45
  description="Enter details about the person and get personalized gift suggestions with shopping links!",
46
  )
47
 
 
2
  from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
  import torch
4
 
5
+ # βœ… Use Llama 2 - 7B Chat (Public)
6
+ model_name = "meta-llama/Llama-2-7b-chat-hf"
7
+
8
+ # πŸ”Ή Authenticate if required (for gated models)
9
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=True)
10
  model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
11
 
12
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=100)
 
43
  fn=recommend_gifts,
44
  inputs="text",
45
  outputs="json",
46
+ title="🎁 AI Gift Recommender (Llama 2 - 7B)",
47
  description="Enter details about the person and get personalized gift suggestions with shopping links!",
48
  )
49