Spaces:
Sleeping
Sleeping
grapplerulrich
commited on
Commit
·
0fbacc4
1
Parent(s):
32e9677
Initial commit of working google search with URL return
Browse files- .gitignore +2 -0
- README.md +13 -0
- google-search/app.py +28 -0
- google-search/requirements.txt +3 -0
- requirements.txt +90 -0
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
/.venv
|
2 |
+
.env
|
README.md
CHANGED
@@ -1,2 +1,15 @@
|
|
1 |
# Raccoon
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Raccoon
|
2 |
|
3 |
+
## Installation
|
4 |
+
|
5 |
+
It is recommend to use virtual environment using [`venv`](https://docs.python.org/3/library/venv.html).
|
6 |
+
|
7 |
+
The fol
|
8 |
+
|
9 |
+
- Ceate the virtual envoirnment: `python3 -m venv .venv`
|
10 |
+
- Activate the virtual envoirnment: `source venv/bin/activate`
|
11 |
+
- To deactive the virtual envoirnment run `deactivate` within the virtual envoirnment.
|
12 |
+
- Install the required packages: `.venv/bin/pip install -r requirements.txt`
|
13 |
+
- `.venv/bin/pip install -e .`
|
14 |
+
- Add the Google Search API key to `GOOGLE_SEARCH_API_KEY` in `google-search/.env`. For example `GOOGLE_SEARCH_API_KEY=addkeyehere`
|
15 |
+
- To start the interface: `streamlit run google-search/app.py`
|
google-search/app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
from googleapiclient.discovery import build
|
4 |
+
import os
|
5 |
+
|
6 |
+
def main():
|
7 |
+
load_dotenv()
|
8 |
+
st.title('Google Search')
|
9 |
+
query = st.text_input('Search query')
|
10 |
+
|
11 |
+
api_key = os.getenv('GOOGLE_SEARCH_API_KEY')
|
12 |
+
service = build(
|
13 |
+
"customsearch",
|
14 |
+
"v1",
|
15 |
+
developerKey=api_key
|
16 |
+
)
|
17 |
+
|
18 |
+
if ( query ):
|
19 |
+
results = service.cse().list(
|
20 |
+
q=query,
|
21 |
+
cx='05048cc2df6134a06',
|
22 |
+
).execute()
|
23 |
+
|
24 |
+
for item in results['items']:
|
25 |
+
st.write(item['link'])
|
26 |
+
|
27 |
+
if __name__ == '__main__':
|
28 |
+
main()
|
google-search/requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
google
|
3 |
+
python-dotenv
|
requirements.txt
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==4.2.0
|
2 |
+
appnope==0.1.2
|
3 |
+
argon2-cffi==21.3.0
|
4 |
+
argon2-cffi-bindings==21.2.0
|
5 |
+
asttokens==2.0.5
|
6 |
+
attrs==21.4.0
|
7 |
+
backcall==0.2.0
|
8 |
+
beautifulsoup4==4.10.0
|
9 |
+
bleach==4.1.0
|
10 |
+
blinker==1.4
|
11 |
+
cachetools==5.0.0
|
12 |
+
certifi==2021.10.8
|
13 |
+
cffi==1.15.0
|
14 |
+
charset-normalizer==2.0.12
|
15 |
+
click==8.0.4
|
16 |
+
debugpy==1.6.0
|
17 |
+
decorator==5.1.1
|
18 |
+
defusedxml==0.7.1
|
19 |
+
entrypoints==0.4
|
20 |
+
executing==0.8.3
|
21 |
+
gitdb==4.0.9
|
22 |
+
GitPython==3.1.27
|
23 |
+
idna==3.3
|
24 |
+
importlib-metadata==4.11.3
|
25 |
+
ipykernel==6.11.0
|
26 |
+
ipython==8.2.0
|
27 |
+
ipython-genutils==0.2.0
|
28 |
+
ipywidgets==7.7.0
|
29 |
+
jedi==0.18.1
|
30 |
+
Jinja2==3.1.1
|
31 |
+
jsonschema==4.4.0
|
32 |
+
jupyter-client==7.2.1
|
33 |
+
jupyter-core==4.9.2
|
34 |
+
jupyterlab-pygments==0.1.2
|
35 |
+
jupyterlab-widgets==1.1.0
|
36 |
+
MarkupSafe==2.1.1
|
37 |
+
matplotlib-inline==0.1.3
|
38 |
+
mistune==0.8.4
|
39 |
+
nbclient==0.5.13
|
40 |
+
nbconvert==6.4.5
|
41 |
+
nbformat==5.2.0
|
42 |
+
nest-asyncio==1.5.4
|
43 |
+
notebook==6.4.10
|
44 |
+
numpy==1.22.3
|
45 |
+
packaging==21.3
|
46 |
+
pandas==1.4.1
|
47 |
+
pandocfilters==1.5.0
|
48 |
+
parso==0.8.3
|
49 |
+
pexpect==4.8.0
|
50 |
+
pickleshare==0.7.5
|
51 |
+
Pillow==9.0.1
|
52 |
+
prometheus-client==0.13.1
|
53 |
+
prompt-toolkit==3.0.28
|
54 |
+
protobuf==3.19.4
|
55 |
+
psutil==5.9.0
|
56 |
+
ptyprocess==0.7.0
|
57 |
+
pure-eval==0.2.2
|
58 |
+
pyarrow==7.0.0
|
59 |
+
pycparser==2.21
|
60 |
+
pydeck==0.7.1
|
61 |
+
Pygments==2.11.2
|
62 |
+
Pympler==1.0.1
|
63 |
+
pyparsing==3.0.7
|
64 |
+
pyrsistent==0.18.1
|
65 |
+
python-dateutil==2.8.2
|
66 |
+
pytz==2022.1
|
67 |
+
pytz-deprecation-shim==0.1.0.post0
|
68 |
+
pyzmq==22.3.0
|
69 |
+
requests==2.27.1
|
70 |
+
semver==2.13.0
|
71 |
+
Send2Trash==1.8.0
|
72 |
+
six==1.16.0
|
73 |
+
smmap==5.0.0
|
74 |
+
soupsieve==2.3.1
|
75 |
+
stack-data==0.2.0
|
76 |
+
streamlit==1.8.1
|
77 |
+
terminado==0.13.3
|
78 |
+
testpath==0.6.0
|
79 |
+
toml==0.10.2
|
80 |
+
toolz==0.11.2
|
81 |
+
tornado==6.1
|
82 |
+
traitlets==5.1.1
|
83 |
+
tzdata==2022.1
|
84 |
+
tzlocal==4.1
|
85 |
+
urllib3==1.26.9
|
86 |
+
validators==0.18.2
|
87 |
+
wcwidth==0.2.5
|
88 |
+
webencodings==0.5.1
|
89 |
+
widgetsnbextension==3.6.0
|
90 |
+
zipp==3.7.0
|