Spaces:
Runtime error
Runtime error
Commit
·
f900d24
1
Parent(s):
99fbd97
Update app.py
Browse files
app.py
CHANGED
@@ -18,10 +18,10 @@ def generate_text(prompt, length=100, theme=None, **kwargs):
|
|
18 |
generation_config_url = "https://huggingface.co/spaces/sailormars18/Yelp-reviews-usingGPT2/blob/main/generation_config.json"
|
19 |
|
20 |
# Load the model from the Hugging Face space
|
21 |
-
model = transformers.GPT2LMHeadModel.from_pretrained(model_url
|
22 |
|
23 |
# Load the tokenizer from the Hugging Face space
|
24 |
-
tokenizer = transformers.GPT2Tokenizer.from_pretrained(
|
25 |
|
26 |
# If a theme is specified, add it to the prompt as a prefix for a special token
|
27 |
if theme:
|
|
|
18 |
generation_config_url = "https://huggingface.co/spaces/sailormars18/Yelp-reviews-usingGPT2/blob/main/generation_config.json"
|
19 |
|
20 |
# Load the model from the Hugging Face space
|
21 |
+
model = transformers.GPT2LMHeadModel.from_pretrained(model_url).to(device)
|
22 |
|
23 |
# Load the tokenizer from the Hugging Face space
|
24 |
+
tokenizer = transformers.GPT2Tokenizer.from_pretrained(config_url)
|
25 |
|
26 |
# If a theme is specified, add it to the prompt as a prefix for a special token
|
27 |
if theme:
|