Thea231 commited on
Commit
fd46b93
·
verified ·
1 Parent(s): ffe1710

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -12,9 +12,15 @@ def img2text(url):
12
 
13
  # text2story
14
  def text2story(text):
15
- text_to_story_model = pipeline("text-generation",model="distilbert/distilgpt2")
16
- story_text = text_to_story_model(text,max_length=100,num_return_sequences=1)
17
- return story_text
 
 
 
 
 
 
18
 
19
  # text2audio
20
  def text2audio(story_text):
 
12
 
13
  # text2story
14
  def text2story(text):
15
+ text_to_story_model = pipeline("text-generation", model="distilbert/distilgpt2")
16
+ if isinstance(text, list):
17
+ text = " ".join(text) # Ensure input is a single string
18
+ story_text = text_to_story_model(text, max_length=100, num_return_sequences=1)
19
+ return story_text[0]['generated_text']
20
+
21
+ #text_to_story_model = pipeline("text-generation",model="distilbert/distilgpt2")
22
+ #story_text = text_to_story_model(text,max_length=100,num_return_sequences=1)
23
+ #return story_text
24
 
25
  # text2audio
26
  def text2audio(story_text):