Update app.py
Browse files
app.py
CHANGED
@@ -2,28 +2,6 @@ import gradio as gr
|
|
2 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
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 |
|
|
|
2 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
3 |
import pytesseract
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Initialize chat model (You can change the model here)
|
6 |
chat_model = pipeline("text-generation", model="gpt2") # You can switch to any model of your choice
|
7 |
|