Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_name, token=hf_token)
|
|
13 |
|
14 |
def generate_code(prompt):
|
15 |
batch_size = 10
|
16 |
-
inputs = tokenizer(
|
17 |
outputs = model.generate(inputs['input_ids'], max_length=512, num_return_sequences=batch_size)
|
18 |
code = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
19 |
return code
|
|
|
13 |
|
14 |
def generate_code(prompt):
|
15 |
batch_size = 10
|
16 |
+
inputs = tokenizer(prompt, return_tensors="pt", padding=True, truncation=True, max_length=512)
|
17 |
outputs = model.generate(inputs['input_ids'], max_length=512, num_return_sequences=batch_size)
|
18 |
code = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
19 |
return code
|