GH111 commited on
Commit
7cd6d1f
Β·
1 Parent(s): cfde699

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -1,11 +1,6 @@
1
-
2
-
3
  # Import libraries
4
  import gradio as gr
5
  from transformers import pipeline
6
- from gtts import gTTS
7
- from io import BytesIO
8
- from IPython.display import Audio
9
 
10
  # Create a text generation pipeline with GPT-2
11
  story_generator = pipeline("text-generation", model="EleutherAI/gpt-neo-1.3B")
@@ -22,22 +17,16 @@ def StorytellerGPT(tell_story):
22
 
23
  messages.append({"role": "assistant", "content": story_reply})
24
 
25
- # Convert text to speech
26
- tts = gTTS(text=story_reply, lang='en', slow=False)
27
- audio_io = BytesIO()
28
- tts.save(audio_io)
29
- audio_io.seek(0)
30
-
31
- return story_reply, Audio(data=audio_io.read(), autoplay=True)
32
 
33
  # Create the Gradio Interface
34
  demo = gr.Interface(
35
  fn=StorytellerGPT,
36
  inputs="text",
37
- outputs=["text", "audio"],
38
  title="πŸ“– Storytelling Magic",
39
  description="A magical storyteller app for kids! Type a sentence, and let the app create an enchanting story for you."
40
  )
41
 
42
  # Launch the Gradio Interface
43
- demo.launch()
 
 
 
1
  # Import libraries
2
  import gradio as gr
3
  from transformers import pipeline
 
 
 
4
 
5
  # Create a text generation pipeline with GPT-2
6
  story_generator = pipeline("text-generation", model="EleutherAI/gpt-neo-1.3B")
 
17
 
18
  messages.append({"role": "assistant", "content": story_reply})
19
 
20
+ return story_reply
 
 
 
 
 
 
21
 
22
  # Create the Gradio Interface
23
  demo = gr.Interface(
24
  fn=StorytellerGPT,
25
  inputs="text",
26
+ outputs="text",
27
  title="πŸ“– Storytelling Magic",
28
  description="A magical storyteller app for kids! Type a sentence, and let the app create an enchanting story for you."
29
  )
30
 
31
  # Launch the Gradio Interface
32
+ demo.launch()