mxiean commited on
Commit
dedc2b8
·
verified ·
1 Parent(s): 639f547

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -11,18 +11,18 @@ def img2text(url):
11
 
12
  # text2story
13
  def text2story(text):
14
- pipe = pipeline("text-generation", model="openai-community/gpt2")
15
  story_text = pipe(text, max_length=100, num_return_sequences=1)[0]['generated_text']
16
  return story_text
17
 
18
  # text2audio
19
  def text2audio(story_text):
20
- pipe = pipeline("text-to-speech", model="facebook/fastspeech2-en-ljspeech")
21
  audio_data = pipe(story_text)
22
  return audio_data
23
 
24
  # main part
25
- def main():
26
  st.set_page_config(page_title="Your Image to Audio Story",
27
  page_icon="🦜")
28
  st.header("Turn Your Image to Audio Story")
@@ -58,5 +58,5 @@ def main():
58
  sample_rate = audio_data['sampling_rate'])
59
 
60
  # Run the main function
61
- if __name__ == "__main__":
62
- main()
 
11
 
12
  # text2story
13
  def text2story(text):
14
+ pipe = pipeline("text-generation", model="pranavpsv/gpt2-story-gen")
15
  story_text = pipe(text, max_length=100, num_return_sequences=1)[0]['generated_text']
16
  return story_text
17
 
18
  # text2audio
19
  def text2audio(story_text):
20
+ pipe = pipeline("text-to-audio", model="Matthijs/mms-tts-nld")
21
  audio_data = pipe(story_text)
22
  return audio_data
23
 
24
  # main part
25
+ # def main():
26
  st.set_page_config(page_title="Your Image to Audio Story",
27
  page_icon="🦜")
28
  st.header("Turn Your Image to Audio Story")
 
58
  sample_rate = audio_data['sampling_rate'])
59
 
60
  # Run the main function
61
+ # if __name__ == "__main__":
62
+ # main()