joshcx commited on
Commit
512c555
·
1 Parent(s): b620f45

Added authentication.

Browse files
Files changed (2) hide show
  1. app.py +32 -11
  2. requirements.txt +4 -0
app.py CHANGED
@@ -1,18 +1,39 @@
1
  import streamlit as st
 
2
  from worker import WorkerClassifier
3
 
4
- MODEL_DIR = "./models/roberta-large"
5
- worker_clf = WorkerClassifier(MODEL_DIR)
6
- worker_clf.init_models()
7
 
8
- text = st.text_input(
9
- "Worker Profile Description", "This candidate is a very warm and kind..."
 
 
 
 
 
10
  )
 
11
 
12
- proc_input, output = worker_clf.predict(text)
 
 
 
 
13
 
14
- st.write(f"**Text used to classify worker profile:**")
15
- st.write(proc_input)
16
- st.write("**Predicted Worker Profile:**")
17
- for i, o in zip(proc_input, output):
18
- st.write(o[0])
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import streamlit_authenticator as stauth
3
  from worker import WorkerClassifier
4
 
5
+ names = ["worker"]
6
+ usernames = ["worker"]
7
+ passwords = ["$2b$12$tpRRH6gyMvH39pb2xYNKFOIFDe6wf1/7bFmA6Xzn0ASjVsAnqAdpG"]
8
 
9
+ authenticator = stauth.Authenticate(
10
+ names,
11
+ usernames,
12
+ passwords,
13
+ "some_cookie_name",
14
+ "some_signature_key",
15
+ cookie_expiry_days=30,
16
  )
17
+ name, authentication_status, username = authenticator.login("Login", "main")
18
 
19
+ if authentication_status:
20
+ authenticator.logout("Logout", "main")
21
+ MODEL_DIR = "./models/roberta-large"
22
+ worker_clf = WorkerClassifier(MODEL_DIR)
23
+ worker_clf.init_models()
24
 
25
+ text = st.text_input(
26
+ "Worker Profile Description", "This candidate is a very warm and kind..."
27
+ )
28
+
29
+ proc_input, output = worker_clf.predict(text)
30
+
31
+ st.write(f"**Text used to classify worker profile:**")
32
+ st.write(proc_input)
33
+ st.write("**Predicted Worker Profile:**")
34
+ for i, o in zip(proc_input, output):
35
+ st.write(o[0])
36
+ elif authentication_status == False:
37
+ st.error("Username/password is incorrect")
38
+ elif authentication_status == None:
39
+ st.warning("Please enter your username and password")
requirements.txt CHANGED
@@ -6,6 +6,7 @@ asttokens==2.0.5
6
  attrs==21.4.0
7
  backcall==0.2.0
8
  backports.zoneinfo==0.2.1
 
9
  beautifulsoup4==4.11.1
10
  bleach==5.0.0
11
  blinker==1.4
@@ -19,6 +20,7 @@ decorator==5.1.1
19
  defusedxml==0.7.1
20
  entrypoints==0.4
21
  executing==0.8.3
 
22
  fastjsonschema==2.15.3
23
  filelock==3.6.0
24
  gitdb==4.0.9
@@ -66,6 +68,7 @@ pyarrow==8.0.0
66
  pycparser==2.21
67
  pydeck==0.7.1
68
  Pygments==2.12.0
 
69
  Pympler==1.0.1
70
  pyparsing==3.0.8
71
  pyrsistent==0.18.1
@@ -84,6 +87,7 @@ smmap==5.0.0
84
  soupsieve==2.3.2.post1
85
  stack-data==0.2.0
86
  streamlit==1.9.0
 
87
  terminado==0.13.3
88
  tinycss2==1.1.1
89
  tokenizers==0.12.1
 
6
  attrs==21.4.0
7
  backcall==0.2.0
8
  backports.zoneinfo==0.2.1
9
+ bcrypt==3.2.2
10
  beautifulsoup4==4.11.1
11
  bleach==5.0.0
12
  blinker==1.4
 
20
  defusedxml==0.7.1
21
  entrypoints==0.4
22
  executing==0.8.3
23
+ extra-streamlit-components==0.1.54
24
  fastjsonschema==2.15.3
25
  filelock==3.6.0
26
  gitdb==4.0.9
 
68
  pycparser==2.21
69
  pydeck==0.7.1
70
  Pygments==2.12.0
71
+ PyJWT==2.4.0
72
  Pympler==1.0.1
73
  pyparsing==3.0.8
74
  pyrsistent==0.18.1
 
87
  soupsieve==2.3.2.post1
88
  stack-data==0.2.0
89
  streamlit==1.9.0
90
+ streamlit-authenticator==0.1.4
91
  terminado==0.13.3
92
  tinycss2==1.1.1
93
  tokenizers==0.12.1