Update app.py
Browse files
app.py
CHANGED
@@ -68,3 +68,18 @@ def generate_graph(story):
|
|
68 |
g.edge(str(i - 1), str(i))
|
69 |
|
70 |
return g
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
g.edge(str(i - 1), str(i))
|
69 |
|
70 |
return g
|
71 |
+
|
72 |
+
st.title("Story Generator")
|
73 |
+
st.write("Click button to generate a new story:")
|
74 |
+
|
75 |
+
if st.button("Generate Story"):
|
76 |
+
story = random.choice(stories)
|
77 |
+
st.header(story["title"])
|
78 |
+
st.markdown("\n".join([f"* {part}" for part in story["outline"]]))
|
79 |
+
|
80 |
+
st.subheader("Story Graph")
|
81 |
+
st.graphviz_chart(generate_graph(story))
|
82 |
+
|
83 |
+
# This Python code creates a Streamlit app that displays a random story from the provided list, renders the markdown outline of the story, and generates a Graphviz graph representing the emojis in each part of the story.
|
84 |
+
|
85 |
+
|