Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,11 @@ tokenizer = GPT2Tokenizer.from_pretrained(model_name)
|
|
8 |
def generate(text):
|
9 |
token_ids = tokenizer.encode(text, return_tensors="pt")
|
10 |
gpt2_tensors = model.generate(token_ids)
|
|
|
11 |
#response= gpt2_tensors
|
12 |
response = ""
|
13 |
-
|
14 |
for i, x in enumerate(gpt2_tensors):
|
15 |
-
|
16 |
return response
|
17 |
|
18 |
in_text = gr.Textbox(lines=1, label="English", placeholder="English text here")
|
|
|
8 |
def generate(text):
|
9 |
token_ids = tokenizer.encode(text, return_tensors="pt")
|
10 |
gpt2_tensors = model.generate(token_ids)
|
11 |
+
|
12 |
#response= gpt2_tensors
|
13 |
response = ""
|
|
|
14 |
for i, x in enumerate(gpt2_tensors):
|
15 |
+
response += f"{i}: {tokenizer.decode(x, skip_special_tokens=True)}"
|
16 |
return response
|
17 |
|
18 |
in_text = gr.Textbox(lines=1, label="English", placeholder="English text here")
|