asd
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
from sentence_splitter import SentenceSplitter
|
|
|
4 |
|
5 |
device = "cuda"
|
6 |
|
@@ -9,6 +10,7 @@ model = AutoModelForSeq2SeqLM.from_pretrained("NoaiGPT/777").to(device)
|
|
9 |
|
10 |
splitter = SentenceSplitter(language='en')
|
11 |
|
|
|
12 |
def process_and_generate(text):
|
13 |
def generate_title(sentence):
|
14 |
input_ids = tokenizer(f'paraphraser: {sentence}', return_tensors="pt", padding="longest", truncation=True, max_length=64).input_ids.to(device)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
from sentence_splitter import SentenceSplitter
|
4 |
+
import spaces
|
5 |
|
6 |
device = "cuda"
|
7 |
|
|
|
10 |
|
11 |
splitter = SentenceSplitter(language='en')
|
12 |
|
13 |
+
@spaces.GPU
|
14 |
def process_and_generate(text):
|
15 |
def generate_title(sentence):
|
16 |
input_ids = tokenizer(f'paraphraser: {sentence}', return_tensors="pt", padding="longest", truncation=True, max_length=64).input_ids.to(device)
|