Update app.py
Browse files
app.py
CHANGED
|
@@ -12,11 +12,17 @@ def img2text(img):
|
|
| 12 |
|
| 13 |
# text2story
|
| 14 |
def text2story(text):
|
|
|
|
|
|
|
| 15 |
text_generation_model = pipeline("text-generation",
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# text2audio
|
| 22 |
def text2audio(story_text):
|
|
@@ -48,7 +54,7 @@ if uploaded_file is not None:
|
|
| 48 |
# stage 2
|
| 49 |
st.text('Generating a story...')
|
| 50 |
scenario = text2story(scenario)
|
| 51 |
-
st.write(
|
| 52 |
|
| 53 |
# stage 3
|
| 54 |
st.text('Generating audio data...')
|
|
|
|
| 12 |
|
| 13 |
# text2story
|
| 14 |
def text2story(text):
|
| 15 |
+
prompt = "Once upon a time in a land far, far away"
|
| 16 |
+
|
| 17 |
text_generation_model = pipeline("text-generation",
|
| 18 |
+
model="distilbert/distilgpt2")
|
| 19 |
+
|
| 20 |
+
generated_story = text_generation_model(prompt,
|
| 21 |
+
max_length=100,
|
| 22 |
+
num_return_sequences=1)
|
| 23 |
+
|
| 24 |
+
print("The story is here......")
|
| 25 |
+
print(generated_story[0]['generated_text'])
|
| 26 |
|
| 27 |
# text2audio
|
| 28 |
def text2audio(story_text):
|
|
|
|
| 54 |
# stage 2
|
| 55 |
st.text('Generating a story...')
|
| 56 |
scenario = text2story(scenario)
|
| 57 |
+
st.write(generated_story)
|
| 58 |
|
| 59 |
# stage 3
|
| 60 |
st.text('Generating audio data...')
|