samvb1002 commited on
Commit
4117870
·
verified ·
1 Parent(s): c0402f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -3,6 +3,27 @@ from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
3
  import pytesseract
4
 
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # Initialize chat model (You can change the model here)
7
  chat_model = pipeline("text-generation", model="gpt2") # You can switch to any model of your choice
8
 
 
3
  import pytesseract
4
 
5
 
6
+ # Load model directly
7
+ from transformers import AutoTokenizer, AutoModelForCausalLM
8
+
9
+ tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")
10
+ model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
11
+ # Use a pipeline as a high-level helper
12
+ from transformers import pipeline
13
+
14
+ messages = [
15
+ {"role": "user", "content": "Who are you?"},
16
+ ]
17
+ pipe = pipeline("text-generation", model="meta-llama/Llama-3.3-70B-Instruct")
18
+ pipe(messages)
19
+
20
+ # Load model directly
21
+ from transformers import AutoTokenizer, AutoModelForCausalLM
22
+
23
+ tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.3-70B-Instruct")
24
+ model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.3-70B-Instruct")
25
+
26
+
27
  # Initialize chat model (You can change the model here)
28
  chat_model = pipeline("text-generation", model="gpt2") # You can switch to any model of your choice
29