Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
import torch
|
2 |
import gradio as gr
|
3 |
-
from transformers import
|
4 |
|
5 |
# Load model and tokenizer
|
6 |
def load_model():
|
7 |
model_name = "zeyadusf/text2pandas-T5"
|
8 |
-
tokenizer =
|
9 |
-
model =
|
10 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
11 |
model = model.to(device)
|
12 |
return model, tokenizer
|
|
|
1 |
import torch
|
2 |
import gradio as gr
|
3 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
4 |
|
5 |
# Load model and tokenizer
|
6 |
def load_model():
|
7 |
model_name = "zeyadusf/text2pandas-T5"
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
10 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
11 |
model = model.to(device)
|
12 |
return model, tokenizer
|