Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ model = AutoModelForCausalLM.from_pretrained("gpt2")
|
|
8 |
def text_generation(input_text, seed):
|
9 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
10 |
torch.manual_seed(seed) # Max value: 18446744073709551615
|
11 |
-
outputs = model.generate(input_ids, do_sample=True, max_length=
|
12 |
generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
13 |
return generated_text
|
14 |
|
|
|
8 |
def text_generation(input_text, seed):
|
9 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
10 |
torch.manual_seed(seed) # Max value: 18446744073709551615
|
11 |
+
outputs = model.generate(input_ids, do_sample=True, max_length=100)
|
12 |
generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
13 |
return generated_text
|
14 |
|