Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,11 @@ import gradio as gr
|
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
3 |
import torch
|
4 |
|
5 |
-
#
|
6 |
-
model_name = "meta-llama/
|
7 |
-
|
|
|
|
|
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
|
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 |
|