Update app.py
Browse files
app.py
CHANGED
|
@@ -46,6 +46,21 @@ def txt2speech(text: str) -> None:
|
|
| 46 |
tts = gTTS(text=text, lang='en')
|
| 47 |
tts.save("audio_story.mp3")
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
# Main Streamlit application
|
| 50 |
def main():
|
| 51 |
st.set_page_config(
|
|
@@ -130,4 +145,4 @@ def main():
|
|
| 130 |
st.audio(st.session_state.audio_file_path)
|
| 131 |
|
| 132 |
if __name__ == '__main__':
|
| 133 |
-
main()
|
|
|
|
| 46 |
tts = gTTS(text=text, lang='en')
|
| 47 |
tts.save("audio_story.mp3")
|
| 48 |
|
| 49 |
+
# Get user preferences function
|
| 50 |
+
def get_user_preferences() -> Dict[str, str]:
|
| 51 |
+
preferences = {
|
| 52 |
+
'continent': st.selectbox("Continent", ["North America", "Europe", "Asia", "Africa", "Australia"]),
|
| 53 |
+
'genre': st.selectbox("Genre", ["Science Fiction", "Fantasy", "Mystery", "Romance"]),
|
| 54 |
+
'setting': st.selectbox("Setting", ["Future", "Medieval times", "Modern day", "Alternate reality"]),
|
| 55 |
+
'plot': st.selectbox("Plot", ["Hero's journey", "Solving a mystery", "Love story", "Survival"]),
|
| 56 |
+
'tone': st.selectbox("Tone", ["Serious", "Light-hearted", "Humorous", "Dark"]),
|
| 57 |
+
'theme': st.selectbox("Theme", ["Self-discovery", "Redemption", "Love", "Justice"]),
|
| 58 |
+
'conflict': st.selectbox("Conflict Type", ["Person vs. Society", "Internal struggle", "Person vs. Nature", "Person vs. Person"]),
|
| 59 |
+
'twist': st.selectbox("Mystery/Twist", ["Plot twist", "Hidden identity", "Unexpected ally/enemy", "Time paradox"]),
|
| 60 |
+
'ending': st.selectbox("Ending", ["Happy", "Bittersweet", "Open-ended", "Tragic"])
|
| 61 |
+
}
|
| 62 |
+
return preferences
|
| 63 |
+
|
| 64 |
# Main Streamlit application
|
| 65 |
def main():
|
| 66 |
st.set_page_config(
|
|
|
|
| 145 |
st.audio(st.session_state.audio_file_path)
|
| 146 |
|
| 147 |
if __name__ == '__main__':
|
| 148 |
+
main()
|