rahul7star commited on
Commit
df3a0f8
·
verified ·
1 Parent(s): 71c892b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -86,7 +86,7 @@ def generate_random_poem(prompt, max_length=150, temperature=1.0, top_p=0.9, num
86
 
87
 
88
 
89
-
90
  # Ensure that we have exactly 4 lines
91
  if len(poem_lines) < num_lines:
92
  while len(poem_lines) < num_lines:
@@ -94,7 +94,7 @@ def generate_random_poem(prompt, max_length=150, temperature=1.0, top_p=0.9, num
94
  random_line = random.choice(dataset["poem"])
95
  poem_lines.append(random_line.strip())
96
 
97
- poem_lines = poem_lines[:num_lines] # Ensure there are only 4 lines
98
 
99
  final_poem = "\n".join(poem_lines)
100
 
 
86
 
87
 
88
 
89
+ num_lines = int(num_lines)
90
  # Ensure that we have exactly 4 lines
91
  if len(poem_lines) < num_lines:
92
  while len(poem_lines) < num_lines:
 
94
  random_line = random.choice(dataset["poem"])
95
  poem_lines.append(random_line.strip())
96
 
97
+ poem_lines = poem_lines[:num_lines]
98
 
99
  final_poem = "\n".join(poem_lines)
100