CreitinGameplays commited on
Commit
33f79d4
1 Parent(s): 2f2e7ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -18,6 +18,7 @@ def generate_text(prompt):
18
  output = model.generate(
19
  input_ids=input_ids,
20
  max_length=256,
 
21
  num_return_sequences=1, # Generate only 1 sequence
22
  do_sample=True, # Enable sampling for creativity
23
  top_k=50, # Sample from the top 50 most likely tokens at each step
@@ -28,7 +29,6 @@ def generate_text(prompt):
28
 
29
  # Decode the generated token sequence back to text
30
  generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
31
- generated_text = generate_text.replace(prompt, "").strip()
32
  return generated_text
33
 
34
  # Define the Gradio interface
 
18
  output = model.generate(
19
  input_ids=input_ids,
20
  max_length=256,
21
+ num_beams=1,
22
  num_return_sequences=1, # Generate only 1 sequence
23
  do_sample=True, # Enable sampling for creativity
24
  top_k=50, # Sample from the top 50 most likely tokens at each step
 
29
 
30
  # Decode the generated token sequence back to text
31
  generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
 
32
  return generated_text
33
 
34
  # Define the Gradio interface