Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
# URL: https://huggingface.co/spaces/gradio/text_generation
|
2 |
# imports
|
3 |
import gradio as gr
|
4 |
-
from transformers import GPT2Tokenizer,
|
5 |
import torch
|
6 |
|
7 |
# loading the model
|
8 |
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
9 |
-
model =
|
10 |
|
11 |
# defining the core function
|
12 |
def generate(text):
|
|
|
1 |
# URL: https://huggingface.co/spaces/gradio/text_generation
|
2 |
# imports
|
3 |
import gradio as gr
|
4 |
+
from transformers import GPT2Tokenizer, GPT2Model
|
5 |
import torch
|
6 |
|
7 |
# loading the model
|
8 |
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
9 |
+
model = GPT2Model.from_pretrained('gpt2')
|
10 |
|
11 |
# defining the core function
|
12 |
def generate(text):
|