Myranda commited on
Commit
a632361
·
1 Parent(s): 5148424

Merge pull request #148 from vanderbilt-data-science/128-org-principles

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -85,6 +85,10 @@ if authentication_status:
85
  # Fetch user data from the database
86
  user_data = get_user_data(username)
87
 
 
 
 
 
88
  if page == "Account Setup":
89
 
90
  st.title("Account Setup")
@@ -99,7 +103,11 @@ if authentication_status:
99
  encrypted_api_key = str(encrypt(api_input, fernet))
100
  st.session_state.api_key = api_input
101
 
102
- principles = st.text_area("My Principles (Paste Principles here)", height = 300, placeholder = "Think about the hate speech you want to counter. What makes you want to write back? Note any principles that are true to your heart, from an abstract thought to a well-defined concept. For ideas, consider: a theory, philosophy, law, policy, workplace professional ethic, cultural norm, family value, idiomatic saying, colloquialism, life lesson, habit, intuition, literary or artistic expression, fortune cookie message, etc.", value=user_data["principles"] if user_data and "principles" in user_data else "")
 
 
 
 
103
  writing_style = st.text_area("My Writing Style (Paste Examples)", height = 300, placeholder = "Provide examples of your writing style here", value=user_data["writing_style"] if user_data and "writing_style" in user_data else "")
104
  #sources = st.text_area("Sources (This autopopulates for your reference)", value=st.session_state.sources if 'sources' in st.session_state else '', key = 'sources_key', height = 100)
105
 
 
85
  # Fetch user data from the database
86
  user_data = get_user_data(username)
87
 
88
+ # get principles from organization-wide file
89
+ with open('org-principles.txt', 'r') as file:
90
+ org_principles = str(file.read())
91
+
92
  if page == "Account Setup":
93
 
94
  st.title("Account Setup")
 
103
  encrypted_api_key = str(encrypt(api_input, fernet))
104
  st.session_state.api_key = api_input
105
 
106
+
107
+ user_principles = user_data["principles"] if user_data and "principles" in user_data else ""
108
+ user_principles = user_principles + "\n" + org_principles
109
+
110
+ principles = st.text_area("My Principles (Paste Principles here. If you affiliated with a registered organization, these principles will also appear here.)", height = 300, placeholder = "Think about the hate speech you want to counter. What makes you want to write back? Note any principles that are true to your heart, from an abstract thought to a well-defined concept. For ideas, consider: a theory, philosophy, law, policy, workplace professional ethic, cultural norm, family value, idiomatic saying, colloquialism, life lesson, habit, intuition, literary or artistic expression, fortune cookie message, etc.", value=user_principles)
111
  writing_style = st.text_area("My Writing Style (Paste Examples)", height = 300, placeholder = "Provide examples of your writing style here", value=user_data["writing_style"] if user_data and "writing_style" in user_data else "")
112
  #sources = st.text_area("Sources (This autopopulates for your reference)", value=st.session_state.sources if 'sources' in st.session_state else '', key = 'sources_key', height = 100)
113