xujinheng666 commited on
Commit
f4c33fa
·
verified ·
1 Parent(s): 853006d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -12,6 +12,10 @@ def img2text(url):
12
 
13
  # text2story
14
  def text2story(text):
 
 
 
 
15
  story_generator = pipeline("text-generation", model="aspis/gpt2-genre-story-generation")
16
  story_text = story_generator(text, max_length=100, num_return_sequences=1)
17
  return story_text[0]["generated_text"]
 
12
 
13
  # text2story
14
  def text2story(text):
15
+ prompt = (
16
+ "Generate a fun, engaging, and kid-friendly story for children aged 3-10. "
17
+ "Based on the following scenario, create a simple, imaginative narrative: " + text
18
+ )
19
  story_generator = pipeline("text-generation", model="aspis/gpt2-genre-story-generation")
20
  story_text = story_generator(text, max_length=100, num_return_sequences=1)
21
  return story_text[0]["generated_text"]