Saugatkafley commited on
Commit
4f8d404
β€’
1 Parent(s): d3d6e19

Inital commit

Browse files
Files changed (4) hide show
  1. .gitignore +134 -0
  2. .vscode/settings.json +6 -0
  3. app.py +95 -0
  4. requirements.txt +51 -0
.gitignore ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # venv directory
132
+ venv/
133
+ project.toml
134
+ test.py
.vscode/settings.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "[python]": {
3
+ "editor.defaultFormatter": "ms-python.black-formatter"
4
+ },
5
+ "python.formatting.provider": "none"
6
+ }
app.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import streamlit as st
3
+ from dotenv import load_dotenv
4
+ from Bard import Chatbot
5
+ import asyncio
6
+
7
+ loop = asyncio.new_event_loop()
8
+ asyncio.set_event_loop(loop)
9
+ load_dotenv()
10
+ WEBSOCKET_TIMEOUT_MS = 10000
11
+
12
+
13
+ def get_token():
14
+ with st.form(key="BARD_API_form"):
15
+ st.markdown(
16
+ "## BARD API token \n Go to https://bard.google.com/ \n "
17
+ "- F12 for console \n "
18
+ "- Copy the values of the cookies: \n "
19
+ " - Session: Go to Application β†’ Cookies β†’ `__Secure-1PSID`. Copy the value of that cookie."
20
+ )
21
+ psid = st.text_input(label="Enter your __Secure-1PSID token")
22
+ psidts = st.text_input(label="Enter your __Secure-1PSIDTS token")
23
+ submit_button = st.form_submit_button(label="Submit")
24
+ return psid, psidts, submit_button
25
+
26
+
27
+ def prompt_letter():
28
+ with st.form(key="my_form_to_submit"):
29
+ st.markdown(
30
+ "## BARD API token \n Go to https://bard.google.com/ \n "
31
+ "- F12 for console \n "
32
+ "- Copy the values of the cookies: \n "
33
+ " - Session: Go to Application β†’ Cookies β†’ `__Secure-1PSID` and `__Secure-1PSIDTS`. Copy the value of both cookies respectively."
34
+ )
35
+ # token will be returned --
36
+ psid = st.text_input(
37
+ label="Enter your __Secure-1PSID",
38
+ max_chars=None,
39
+ type="default",
40
+ placeholder="Place yours PSID. It ends with a dot.",
41
+ )
42
+ psidts = st.text_input(
43
+ label="Enter your __Secure-1PSIDTS",
44
+ max_chars=None,
45
+ type="default",
46
+ placeholder="Place yours PSIDTS...",
47
+ )
48
+
49
+ company_name = st.text_input("Company Name: ", "Google")
50
+ role = st.text_input(
51
+ "What role are you applying for? ", "Machine Learning Engineer"
52
+ )
53
+ contact_person = st.text_input("Who are you emailing? ", "Hiring Manager")
54
+ your_name = st.text_input("What is your name? ", "Hari Bahadur")
55
+ personal_exp = st.text_input(
56
+ "I have experience in...",
57
+ "natural language processing, fraud detection, statistical modeling, and machine learning algorithms. ",
58
+ )
59
+ job_desc = st.text_input(
60
+ "I am excited about the job because...",
61
+ "this role will allow me to work on technically challenging problems and create impactful solutions while working with an innovative team. ",
62
+ )
63
+ passion = st.text_input(
64
+ "I am passionate about...",
65
+ "solving problems at the intersection of technology and social good.",
66
+ )
67
+ submit_button = st.form_submit_button(label="Submit")
68
+
69
+ prompt = (
70
+ "Write a cover letter to "
71
+ + contact_person
72
+ + " from "
73
+ + your_name
74
+ + " for a "
75
+ + role
76
+ + " job at "
77
+ + company_name
78
+ + "."
79
+ + " I have experience in "
80
+ + personal_exp
81
+ + " I am excited about the job because "
82
+ + job_desc
83
+ + " I am passionate about "
84
+ + passion
85
+ )
86
+ return psid, psidts, prompt, submit_button
87
+
88
+
89
+ psid, psidts, prompt, submit_button = prompt_letter()
90
+
91
+ if submit_button:
92
+ chatbot = Chatbot(psid, psidts)
93
+ ans = chatbot.ask(prompt)
94
+ st.write("\n _Please read it carefully and make changes as needed._ \n")
95
+ st.write(ans["content"])
requirements.txt ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==5.0.1
2
+ attrs==23.1.0
3
+ bardapi==0.1.11
4
+ blinker==1.6.2
5
+ cachetools==5.3.1
6
+ certifi==2023.5.7
7
+ charset-normalizer==3.1.0
8
+ click==8.1.3
9
+ decorator==5.1.1
10
+ gitdb==4.0.10
11
+ GitPython==3.1.31
12
+ GoogleBard==1.0.3
13
+ idna==3.4
14
+ importlib-metadata==6.6.0
15
+ Jinja2==3.1.2
16
+ jsonschema==4.17.3
17
+ markdown-it-py==2.2.0
18
+ MarkupSafe==2.1.3
19
+ mdurl==0.1.2
20
+ numpy==1.24.3
21
+ packaging==23.1
22
+ pandas==2.0.2
23
+ Pillow==9.5.0
24
+ prompt-toolkit==3.0.38
25
+ protobuf==4.23.2
26
+ pyarrow==12.0.0
27
+ pydeck==0.8.1b0
28
+ Pygments==2.15.1
29
+ Pympler==1.0.1
30
+ pyrsistent==0.19.3
31
+ python-dateutil==2.8.2
32
+ python-dotenv==1.0.0
33
+ pytz==2023.3
34
+ pytz-deprecation-shim==0.1.0.post0
35
+ requests==2.30.0
36
+ rich==13.3.5
37
+ six==1.16.0
38
+ smmap==5.0.0
39
+ streamlit==1.23.1
40
+ tenacity==8.2.2
41
+ toml==0.10.2
42
+ toolz==0.12.0
43
+ tornado==6.3.2
44
+ typing_extensions==4.6.3
45
+ tzdata==2023.3
46
+ tzlocal==4.3
47
+ urllib3==2.0.2
48
+ validators==0.20.0
49
+ watchdog==3.0.0
50
+ wcwidth==0.2.6
51
+ zipp==3.15.0