asdasd
Browse files
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
-
|
4 |
device = "cuda"
|
5 |
|
6 |
tokenizer = AutoTokenizer.from_pretrained("NoaiGPT/777")
|
7 |
model = AutoModelForSeq2SeqLM.from_pretrained("NoaiGPT/777").to(device)
|
8 |
|
|
|
9 |
def generate_title(text):
|
10 |
input_ids = tokenizer(f'paraphraser: {text}', return_tensors="pt", padding="longest", truncation=True, max_length=64).input_ids.to(device)
|
11 |
outputs = model.generate(
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
+
import spaces
|
4 |
device = "cuda"
|
5 |
|
6 |
tokenizer = AutoTokenizer.from_pretrained("NoaiGPT/777")
|
7 |
model = AutoModelForSeq2SeqLM.from_pretrained("NoaiGPT/777").to(device)
|
8 |
|
9 |
+
@spaces.GPU
|
10 |
def generate_title(text):
|
11 |
input_ids = tokenizer(f'paraphraser: {text}', return_tensors="pt", padding="longest", truncation=True, max_length=64).input_ids.to(device)
|
12 |
outputs = model.generate(
|