Jessiesj commited on
Commit
96cefd3
·
verified ·
1 Parent(s): 88c50c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -10,7 +10,9 @@ def img2text(url):
10
 
11
  # text2story
12
  def text2story(text):
13
- story_text = "" # to be completed
 
 
14
  return story_text
15
 
16
  # text2audio
@@ -41,14 +43,14 @@ if uploaded_file is not None:
41
  story = text2story(scenario)
42
  st.write(story)
43
 
44
- #Stage 3: Story to Audio data
45
- st.text('Generating audio data...')
46
- audio_data =text2audio(story)
47
-
48
- # Play button
49
- if st.button("Play Audio"):
50
- st.audio(audio_data['audio'],
51
- format="audio/wav",
52
- start_time=0,
53
- sample_rate = audio_data['sampling_rate'])
54
- # st.audio("kids_playing_audio.wav")
 
10
 
11
  # text2story
12
  def text2story(text):
13
+ text_to_story = pipeline("text-generation", model="isarth/distill_gpt2_story_generator")
14
+ # story_text = "" # to be completed
15
+ story_text = text_to_story(text)[0]["generated_text"]
16
  return story_text
17
 
18
  # text2audio
 
43
  story = text2story(scenario)
44
  st.write(story)
45
 
46
+ # #Stage 3: Story to Audio data
47
+ # st.text('Generating audio data...')
48
+ # audio_data =text2audio(story)
49
+
50
+ # # Play button
51
+ # if st.button("Play Audio"):
52
+ # st.audio(audio_data['audio'],
53
+ # format="audio/wav",
54
+ # start_time=0,
55
+ # sample_rate = audio_data['sampling_rate'])
56
+ # # st.audio("kids_playing_audio.wav")