Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
|
@@ -7,7 +6,6 @@ from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
|
| 7 |
model = GPT2LMHeadModel.from_pretrained("gpt2")
|
| 8 |
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
| 9 |
|
| 10 |
-
@spaces.GPU
|
| 11 |
def get_next_token_probs(text):
|
| 12 |
# Handle empty input
|
| 13 |
if not text.strip():
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
|
|
|
| 6 |
model = GPT2LMHeadModel.from_pretrained("gpt2")
|
| 7 |
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
| 8 |
|
|
|
|
| 9 |
def get_next_token_probs(text):
|
| 10 |
# Handle empty input
|
| 11 |
if not text.strip():
|