-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
81 lines (61 loc) · 2.72 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from textwrap import dedent
import streamlit as st
from icecream import ic
from launchr.interview import generate_interview
from launchr.personas import generate_personas
from launchr.summarize import generate_idea_hypothesis, generate_overall_summary
from launchr.utils import strip_markdown_tags
def main():
st.title("Idea Analysis Tool")
placeholder_idea = dedent("""
App that helps people learn how to code.
""").strip()
idea = st.text_area("Enter your idea:", height=150, placeholder=placeholder_idea)
ic(idea)
if "hypothesis" not in st.session_state:
st.session_state.hypothesis = ""
hypothesis = ""
else:
hypothesis = st.session_state.hypothesis
if st.button("Generate Idea Hypothesis"):
if idea:
st.session_state.hypothesis = generate_idea_hypothesis(idea)
hypothesis = st.session_state.hypothesis
else:
hypothesis = ""
st.write(hypothesis)
idea_hypothesis = idea + "\n\n" + hypothesis
placeholder_personas = dedent("""
- Sales Agent, 35, Male, New York, Loves the challenge of closing deals, Enjoys travel, Enjoys golf, Enjoys skiing
- Marketing Agent, 28, Female, San Francisco, Loves the challenge of creating engaging content, Enjoys yoga, Enjoys hiking, Enjoys meditation
- Customer Support Agent, 42, Male, Chicago, Loves the challenge of helping customers, Enjoys reading, Enjoys biking, Enjoys cooking
""").strip()
sample_personas = st.text_area(
"(Optional) Enter some sample personas:",
height=150,
placeholder=placeholder_personas,
)
if hypothesis:
if st.button("Analyze"):
if idea:
personas_result = generate_personas(idea, sample_personas)
ic(personas_result)
with st.expander("Generated Personas"):
st.json(personas_result)
# TODO: make an answers generator
# questions_result = generate_questions(personas_result)
# ic(questions_result)
interviews = []
for persona in personas_result.personas:
interview = generate_interview(idea, persona)
interviews.append(interview)
with st.expander("Generated Personas and Pain Points"):
st.json(interviews)
summary = generate_overall_summary(idea, interviews)
ic(summary)
st.subheader("Generated Personas and Pain Points")
st.markdown(strip_markdown_tags(summary).strip())
else:
st.warning("Please enter some business context first.")
if __name__ == "__main__":
main()