npc0 commited on
Commit
ab9bf14
·
verified ·
1 Parent(s): cba281c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -37,11 +37,14 @@ if 'ft' in st.session_state or st.button('Next step'):
37
  )
38
  st.session_state['ft'] = chat_completion.choices[0].message.content
39
 
 
 
 
40
  st.session_state['ft'] = st.text_area(
41
  "Factors to be considered in questions",
42
  st.session_state['ft'],
43
  height=300)
44
- st.write('Edit above factors, add or remove if needed')
45
 
46
  ft = st.session_state['ft']
47
  rf = os.environ.get("DESIGN_PROMPT")
@@ -52,8 +55,8 @@ if 'ft' in st.session_state or st.button('Next step'):
52
  {
53
  "role": "user",
54
  "content": f"""Extract all factors from the text to create context.
55
- Generate 5 question based on the text and context.
56
- Write the questionnaire form in markdown\n\n
57
  text:\n\n{ft}\n\n
58
  some design principles for your reference:\n\n
59
  reference:\n\n```markdown\n{rf}\n```\n\n""",
@@ -66,8 +69,9 @@ if 'ft' in st.session_state or st.button('Next step'):
66
  )
67
 
68
  md = chat_completion.choices[0].message.content
69
- suggested_sampling = 5 * len(md.split("\n"))
70
- st.markdown(f"{md}\n\n**suggested number of sampling**: {suggested_sampling}")
71
  # dump questions into excel and allow download
72
 
73
- del st.session_state['ft']
 
 
37
  )
38
  st.session_state['ft'] = chat_completion.choices[0].message.content
39
 
40
+ am = st.text_area("Assumption to be tested",
41
+ placeholder="""What is the assumption you want to verify
42
+ through the polling""")
43
  st.session_state['ft'] = st.text_area(
44
  "Factors to be considered in questions",
45
  st.session_state['ft'],
46
  height=300)
47
+ st.info('Before next step. Edit above factors, add or remove if needed')
48
 
49
  ft = st.session_state['ft']
50
  rf = os.environ.get("DESIGN_PROMPT")
 
55
  {
56
  "role": "user",
57
  "content": f"""Extract all factors from the text to create context.
58
+ Generate 5 question based on the text and context.\n\n
59
+ assumption to be tested through the questionnaire:\n\n{am}\n\n
60
  text:\n\n{ft}\n\n
61
  some design principles for your reference:\n\n
62
  reference:\n\n```markdown\n{rf}\n```\n\n""",
 
69
  )
70
 
71
  md = chat_completion.choices[0].message.content
72
+ st.markdown(md)
73
+ st.info('Suggested number of sampling is 5 to 10 times of number of questions', icon="ℹ️")
74
  # dump questions into excel and allow download
75
 
76
+ if st.button('Restart'):
77
+ del st.session_state['ft']