Spaces:
Sleeping
Sleeping
Commit
•
e95e6f0
1
Parent(s):
df14c05
Use streamlit secrets instead of env
Browse files- .gitignore +1 -0
- main.py +4 -7
.gitignore
CHANGED
@@ -5,3 +5,4 @@ __pycache__
|
|
5 |
/web-pages
|
6 |
/page-content
|
7 |
/summaries
|
|
|
|
5 |
/web-pages
|
6 |
/page-content
|
7 |
/summaries
|
8 |
+
/.streamlit
|
main.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
-
|
2 |
-
from os import getenv, remove
|
3 |
from os.path import exists
|
4 |
from functools import cache
|
5 |
import json
|
6 |
import streamlit as st
|
7 |
-
from dotenv import load_dotenv
|
8 |
from googleapiclient.discovery import build
|
9 |
from slugify import slugify
|
10 |
from transformers import pipeline
|
@@ -14,9 +12,8 @@ from beautiful_soup.app import get_url_content
|
|
14 |
|
15 |
@cache
|
16 |
def google_search_api_request( query ):
|
17 |
-
|
18 |
-
|
19 |
-
# cx = os.getenv('GOOGLE_SEARCH_ENGINE_ID')
|
20 |
service = build(
|
21 |
"customsearch",
|
22 |
"v1",
|
@@ -29,7 +26,7 @@ def google_search_api_request( query ):
|
|
29 |
|
30 |
return service.cse().list(
|
31 |
q=query,
|
32 |
-
cx=
|
33 |
num=5,
|
34 |
).execute()
|
35 |
|
|
|
1 |
+
from os import remove
|
|
|
2 |
from os.path import exists
|
3 |
from functools import cache
|
4 |
import json
|
5 |
import streamlit as st
|
|
|
6 |
from googleapiclient.discovery import build
|
7 |
from slugify import slugify
|
8 |
from transformers import pipeline
|
|
|
12 |
|
13 |
@cache
|
14 |
def google_search_api_request( query ):
|
15 |
+
api_key = st.secrets["google_search_api_key"]
|
16 |
+
cx = st.secrets["google_search_engine_id"]
|
|
|
17 |
service = build(
|
18 |
"customsearch",
|
19 |
"v1",
|
|
|
26 |
|
27 |
return service.cse().list(
|
28 |
q=query,
|
29 |
+
cx=cx,
|
30 |
num=5,
|
31 |
).execute()
|
32 |
|