Mertyg commited on
Commit
90bd068
·
1 Parent(s): 5faa897
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -13,6 +13,29 @@ import os
13
  my_api_key = os.environ["OPENAI_API_KEY"]
14
  client_openai = OpenAI(api_key=my_api_key)
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  # converts paper pdf into text
17
  def pdf_to_text(pdf):
18
  paper_text = ''
 
13
  my_api_key = os.environ["OPENAI_API_KEY"]
14
  client_openai = OpenAI(api_key=my_api_key)
15
 
16
+
17
+ # Check if the password matches the env variable
18
+ def check_password():
19
+ def password_entered():
20
+ if st.session_state["password"] == os.environ["APP_PASSCODE"]:
21
+ st.session_state["password_correct"] = True
22
+ del st.session_state["password"] # Clear password from memory
23
+ else:
24
+ st.session_state["password_correct"] = False
25
+
26
+ if "password_correct" not in st.session_state:
27
+ st.text_input("Enter Password", type="password", on_change=password_entered, key="password")
28
+ return False
29
+ elif not st.session_state["password_correct"]:
30
+ st.error("Password incorrect")
31
+ return False
32
+ else:
33
+ return True
34
+
35
+ # Ask for password at the beginning
36
+ if not check_password():
37
+ st.stop()
38
+
39
  # converts paper pdf into text
40
  def pdf_to_text(pdf):
41
  paper_text = ''