Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,17 @@ def text2story(text):
|
|
17 |
|
18 |
# Create a prompt for the story generation
|
19 |
prompt = f"Write a fun children's story based on this: {text}. Once upon a time, "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
# Extract the generated text
|
22 |
story_text = story_result[0]['generated_text']
|
|
|
17 |
|
18 |
# Create a prompt for the story generation
|
19 |
prompt = f"Write a fun children's story based on this: {text}. Once upon a time, "
|
20 |
+
|
21 |
+
# Generate the story
|
22 |
+
story_result = generator(
|
23 |
+
prompt,
|
24 |
+
max_length=150,
|
25 |
+
num_return_sequences=1,
|
26 |
+
temperature=0.7,
|
27 |
+
top_k=50,
|
28 |
+
top_p=0.95,
|
29 |
+
do_sample=True
|
30 |
+
)
|
31 |
|
32 |
# Extract the generated text
|
33 |
story_text = story_result[0]['generated_text']
|