truongghieu commited on
Commit
ef62570
·
1 Parent(s): 3c95783

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -1,3 +1,13 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
2
 
3
  gr.load("models/meta-llama/Llama-2-7b-hf").launch()
 
1
  import gradio as gr
2
+ # Load model directly
3
+ from transformers import AutoTokenizer, AutoModelForCausalLM
4
+ # Use a pipeline as a high-level helper
5
+ from transformers import pipeline
6
+
7
+ pipe = pipeline("text-generation", model="meta-llama/Llama-2-7b-chat-hf")
8
+
9
+ tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
10
+ model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
11
+
12
 
13
  gr.load("models/meta-llama/Llama-2-7b-hf").launch()