Spaces:
Build error
Build error
Upload 5 files
Browse files
Procfile
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
web: sh setup.sh && streamlit run app.py
|
| 2 |
+
|
app.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import openai
|
| 3 |
+
from serpapi import GoogleSearch
|
| 4 |
+
|
| 5 |
+
# Set up your OpenAI API key
|
| 6 |
+
openai.api_key = "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"
|
| 7 |
+
|
| 8 |
+
# Define a function to search images using GoogleSearch API
|
| 9 |
+
def search_images(query):
|
| 10 |
+
params = {
|
| 11 |
+
"engine": "google",
|
| 12 |
+
"tbm": "isch",
|
| 13 |
+
"q": query,
|
| 14 |
+
"api_key": "bebb5ff17b2faddf1eec1636ac6dc093d1892da946c28df6a41c3425f09bb4a3"
|
| 15 |
+
}
|
| 16 |
+
search = GoogleSearch(params)
|
| 17 |
+
data = search.get_dict()
|
| 18 |
+
if data.get('search_metadata').get('status') == 'Success':
|
| 19 |
+
results = data.get('images_results')
|
| 20 |
+
if results:
|
| 21 |
+
images = []
|
| 22 |
+
for result in results:
|
| 23 |
+
images.append(result['original'])
|
| 24 |
+
return images[:10]
|
| 25 |
+
else:
|
| 26 |
+
return "No results found."
|
| 27 |
+
else:
|
| 28 |
+
return "Search failed. Please try again later."
|
| 29 |
+
|
| 30 |
+
# Define a function to generate a response to a given question using OpenAI
|
| 31 |
+
def generate_response(question):
|
| 32 |
+
response = openai.Completion.create(
|
| 33 |
+
engine="text-davinci-002",
|
| 34 |
+
prompt=question,
|
| 35 |
+
temperature=0.5,
|
| 36 |
+
max_tokens=1024,
|
| 37 |
+
n=1,
|
| 38 |
+
stop=None,
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
message = response.choices[0].text.strip()
|
| 42 |
+
return message
|
| 43 |
+
|
| 44 |
+
# Set up the Streamlit app
|
| 45 |
+
st.title("Welcome to Tourism AI Chatbot")
|
| 46 |
+
st.write("Please enter your tourism related query below:")
|
| 47 |
+
|
| 48 |
+
# Get user input and generate response
|
| 49 |
+
query = st.text_area("Your question here")
|
| 50 |
+
if st.button("Get Answer"):
|
| 51 |
+
response = generate_response(query)
|
| 52 |
+
st.write(response)
|
| 53 |
+
|
| 54 |
+
# Set up the Streamlit app for image search
|
| 55 |
+
st.title("Image Search using Google API")
|
| 56 |
+
st.write("Please enter your search query below:")
|
| 57 |
+
|
| 58 |
+
# Get user input and display image results
|
| 59 |
+
query = st.text_input("Search images here")
|
| 60 |
+
if st.button("Search"):
|
| 61 |
+
images = search_images(query)
|
| 62 |
+
if type(images) == str:
|
| 63 |
+
st.write(images)
|
| 64 |
+
else:
|
| 65 |
+
for image in images:
|
| 66 |
+
st.image(image, use_column_width=True)
|
| 67 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
absl-py==1.4.0
|
| 2 |
+
aiofiles==23.1.0
|
| 3 |
+
aiohttp==3.8.4
|
| 4 |
+
aiosignal==1.3.1
|
| 5 |
+
altair==4.2.0
|
| 6 |
+
anyio==3.6.2
|
| 7 |
+
apturl==0.5.2
|
| 8 |
+
argon2-cffi==21.3.0
|
| 9 |
+
argon2-cffi-bindings==21.2.0
|
| 10 |
+
aspose-words==23.2.0
|
| 11 |
+
asttokens==2.0.8
|
| 12 |
+
async-timeout==4.0.2
|
| 13 |
+
attrs==22.1.0
|
| 14 |
+
backcall==0.2.0
|
| 15 |
+
bcrypt==3.2.0
|
| 16 |
+
beautifulsoup4==4.11.1
|
| 17 |
+
bleach==5.0.1
|
| 18 |
+
blinker==1.4
|
| 19 |
+
Brlapi==0.8.3
|
| 20 |
+
cachetools==5.2.0
|
| 21 |
+
certifi==2020.6.20
|
| 22 |
+
cffi==1.15.1
|
| 23 |
+
chardet==4.0.0
|
| 24 |
+
charset-normalizer==3.1.0
|
| 25 |
+
click==8.0.3
|
| 26 |
+
colorama==0.4.4
|
| 27 |
+
command-not-found==0.3
|
| 28 |
+
commonmark==0.9.1
|
| 29 |
+
contourpy==1.0.6
|
| 30 |
+
cryptography==3.4.8
|
| 31 |
+
cupshelpers==1.0
|
| 32 |
+
cvxopt==1.3.0
|
| 33 |
+
cvxpy==1.2.2
|
| 34 |
+
cycler==0.11.0
|
| 35 |
+
dataclasses-json==0.5.7
|
| 36 |
+
dbus-python==1.2.18
|
| 37 |
+
debugpy==1.6.3
|
| 38 |
+
decorator==5.1.1
|
| 39 |
+
defer==1.0.6
|
| 40 |
+
defusedxml==0.7.1
|
| 41 |
+
distro==1.7.0
|
| 42 |
+
distro-info===1.1build1
|
| 43 |
+
duplicity==0.8.21
|
| 44 |
+
ecos==2.0.10
|
| 45 |
+
entrypoints==0.4
|
| 46 |
+
executing==1.1.0
|
| 47 |
+
fastapi==0.95.0
|
| 48 |
+
fasteners==0.14.1
|
| 49 |
+
fastjsonschema==2.16.2
|
| 50 |
+
ffmpy==0.3.0
|
| 51 |
+
filelock==3.10.7
|
| 52 |
+
Flask==2.2.3
|
| 53 |
+
flatbuffers==23.3.3
|
| 54 |
+
fonttools==4.38.0
|
| 55 |
+
frozenlist==1.3.3
|
| 56 |
+
fsspec==2023.3.0
|
| 57 |
+
future==0.18.2
|
| 58 |
+
gitdb==4.0.10
|
| 59 |
+
GitPython==3.1.29
|
| 60 |
+
google==3.0.0
|
| 61 |
+
google-auth==2.17.2
|
| 62 |
+
google-auth-oauthlib==1.0.0
|
| 63 |
+
google-cloud==0.34.0
|
| 64 |
+
google-search-results==2.4.2
|
| 65 |
+
gpt-index==0.5.8
|
| 66 |
+
gradio==3.24.1
|
| 67 |
+
gradio_client==0.0.7
|
| 68 |
+
greenlet==2.0.2
|
| 69 |
+
grpcio==1.51.1
|
| 70 |
+
h11==0.14.0
|
| 71 |
+
httpcore==0.16.3
|
| 72 |
+
httplib2==0.20.2
|
| 73 |
+
httpx==0.23.3
|
| 74 |
+
huggingface-hub==0.13.3
|
| 75 |
+
idna==3.3
|
| 76 |
+
importlib-metadata==4.6.4
|
| 77 |
+
install==1.3.5
|
| 78 |
+
ipykernel==6.16.0
|
| 79 |
+
ipython==8.5.0
|
| 80 |
+
ipython-genutils==0.2.0
|
| 81 |
+
itsdangerous==2.1.2
|
| 82 |
+
jedi==0.18.1
|
| 83 |
+
jeepney==0.7.1
|
| 84 |
+
Jinja2==3.1.2
|
| 85 |
+
jsonschema==4.16.0
|
| 86 |
+
jupyter-core==4.11.1
|
| 87 |
+
jupyter_client==7.3.5
|
| 88 |
+
jupyterlab-pygments==0.2.2
|
| 89 |
+
keyring==23.5.0
|
| 90 |
+
kiwisolver==1.4.4
|
| 91 |
+
langchain==0.0.132
|
| 92 |
+
language-selector==0.1
|
| 93 |
+
launchpadlib==1.10.16
|
| 94 |
+
lazr.restfulclient==0.14.4
|
| 95 |
+
lazr.uri==1.0.6
|
| 96 |
+
linkify-it-py==2.0.0
|
| 97 |
+
llama-index==0.5.8
|
| 98 |
+
lockfile==0.12.2
|
| 99 |
+
louis==3.20.0
|
| 100 |
+
lxml==4.9.1
|
| 101 |
+
macaroonbakery==1.3.1
|
| 102 |
+
Mako==1.1.3
|
| 103 |
+
markdown-it-py==2.2.0
|
| 104 |
+
MarkupSafe==2.1.2
|
| 105 |
+
marshmallow==3.19.0
|
| 106 |
+
marshmallow-enum==1.5.1
|
| 107 |
+
matplotlib==3.6.2
|
| 108 |
+
matplotlib-inline==0.1.6
|
| 109 |
+
mdit-py-plugins==0.3.3
|
| 110 |
+
mdurl==0.1.2
|
| 111 |
+
mediapipe==0.9.2.1
|
| 112 |
+
mistune==2.0.4
|
| 113 |
+
monotonic==1.6
|
| 114 |
+
more-itertools==8.10.0
|
| 115 |
+
multidict==6.0.4
|
| 116 |
+
mypy-extensions==1.0.0
|
| 117 |
+
nbclient==0.6.8
|
| 118 |
+
nbconvert==7.0.0
|
| 119 |
+
nbformat==5.6.1
|
| 120 |
+
nest-asyncio==1.5.5
|
| 121 |
+
netifaces==0.11.0
|
| 122 |
+
notebook==6.4.12
|
| 123 |
+
numpy==1.23.3
|
| 124 |
+
nvidia-cublas-cu11==11.10.3.66
|
| 125 |
+
nvidia-cuda-nvrtc-cu11==11.7.99
|
| 126 |
+
nvidia-cuda-runtime-cu11==11.7.99
|
| 127 |
+
nvidia-cudnn-cu11==8.5.0.96
|
| 128 |
+
oauthlib==3.2.0
|
| 129 |
+
olefile==0.46
|
| 130 |
+
openai==0.27.4
|
| 131 |
+
opencv-contrib-python==4.7.0.72
|
| 132 |
+
opencv-python==4.7.0.72
|
| 133 |
+
orjson==3.8.9
|
| 134 |
+
osqp==0.6.2.post5
|
| 135 |
+
packaging==21.3
|
| 136 |
+
pandas==1.5.0
|
| 137 |
+
pandocfilters==1.5.0
|
| 138 |
+
paramiko==2.9.3
|
| 139 |
+
parso==0.8.3
|
| 140 |
+
pexpect==4.8.0
|
| 141 |
+
pickleshare==0.7.5
|
| 142 |
+
Pillow==9.0.1
|
| 143 |
+
prometheus-client==0.14.1
|
| 144 |
+
prompt-toolkit==3.0.31
|
| 145 |
+
protobuf==4.22.1
|
| 146 |
+
psutil==5.9.2
|
| 147 |
+
ptyprocess==0.7.0
|
| 148 |
+
pure-eval==0.2.2
|
| 149 |
+
pyarrow==10.0.1
|
| 150 |
+
pyasn1==0.4.8
|
| 151 |
+
pyasn1-modules==0.2.8
|
| 152 |
+
pycairo==1.20.1
|
| 153 |
+
pycparser==2.21
|
| 154 |
+
pycups==2.0.1
|
| 155 |
+
pydantic==1.10.7
|
| 156 |
+
pydeck==0.8.0
|
| 157 |
+
pydub==0.25.1
|
| 158 |
+
Pygments==2.13.0
|
| 159 |
+
PyGObject==3.42.1
|
| 160 |
+
PyJWT==2.3.0
|
| 161 |
+
pymacaroons==0.13.0
|
| 162 |
+
Pympler==1.0.1
|
| 163 |
+
PyNaCl==1.5.0
|
| 164 |
+
pyparsing==2.4.7
|
| 165 |
+
PyPDF2==3.0.1
|
| 166 |
+
pyRFC3339==1.1
|
| 167 |
+
pyrsistent==0.18.1
|
| 168 |
+
python-apt==2.3.0+ubuntu2.1
|
| 169 |
+
python-dateutil==2.8.2
|
| 170 |
+
python-debian===0.1.43ubuntu1
|
| 171 |
+
python-multipart==0.0.6
|
| 172 |
+
pyttsx3==2.90
|
| 173 |
+
pytz==2022.1
|
| 174 |
+
pytz-deprecation-shim==0.1.0.post0
|
| 175 |
+
pyxdg==0.27
|
| 176 |
+
PyYAML==5.4.1
|
| 177 |
+
pyzmq==24.0.1
|
| 178 |
+
qdldl==0.1.5.post2
|
| 179 |
+
regex==2023.3.23
|
| 180 |
+
reportlab==3.6.8
|
| 181 |
+
requests==2.28.2
|
| 182 |
+
requests-oauthlib==1.3.1
|
| 183 |
+
rfc3986==1.5.0
|
| 184 |
+
rich==12.6.0
|
| 185 |
+
rsa==4.9
|
| 186 |
+
scipy==1.9.3
|
| 187 |
+
scs==3.2.2
|
| 188 |
+
seaborn==0.12.2
|
| 189 |
+
SecretStorage==3.3.1
|
| 190 |
+
semantic-version==2.10.0
|
| 191 |
+
semver==2.13.0
|
| 192 |
+
Send2Trash==1.8.0
|
| 193 |
+
six==1.16.0
|
| 194 |
+
smmap==5.0.0
|
| 195 |
+
sniffio==1.3.0
|
| 196 |
+
soupsieve==2.3.2.post1
|
| 197 |
+
SQLAlchemy==1.4.47
|
| 198 |
+
stack-data==0.5.1
|
| 199 |
+
starlette==0.26.1
|
| 200 |
+
streamlit==1.16.0
|
| 201 |
+
systemd-python==234
|
| 202 |
+
tenacity==8.2.2
|
| 203 |
+
terminado==0.15.0
|
| 204 |
+
tiktoken==0.3.3
|
| 205 |
+
tinycss2==1.1.1
|
| 206 |
+
toml==0.10.2
|
| 207 |
+
toolz==0.12.0
|
| 208 |
+
torch==1.13.0
|
| 209 |
+
torchvision==0.14.0
|
| 210 |
+
tornado==6.2
|
| 211 |
+
tqdm==4.64.1
|
| 212 |
+
traitlets==5.4.0
|
| 213 |
+
typing-inspect==0.8.0
|
| 214 |
+
typing_extensions==4.4.0
|
| 215 |
+
tzdata==2022.7
|
| 216 |
+
tzlocal==4.2
|
| 217 |
+
ubuntu-advantage-tools==8001
|
| 218 |
+
ubuntu-drivers-common==0.0.0
|
| 219 |
+
uc-micro-py==1.0.1
|
| 220 |
+
ufw==0.36.1
|
| 221 |
+
unattended-upgrades==0.1
|
| 222 |
+
urllib3==1.26.5
|
| 223 |
+
usb-creator==0.3.7
|
| 224 |
+
uvicorn==0.21.1
|
| 225 |
+
validators==0.20.0
|
| 226 |
+
wadllib==1.3.6
|
| 227 |
+
watchdog==2.2.0
|
| 228 |
+
wcwidth==0.2.5
|
| 229 |
+
webencodings==0.5.1
|
| 230 |
+
websockets==11.0
|
| 231 |
+
Werkzeug==2.2.3
|
| 232 |
+
xdg==5
|
| 233 |
+
xkit==0.0.0
|
| 234 |
+
yarl==1.8.2
|
| 235 |
+
zipp==1.0.0
|
setup.sh
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
mkdir -p ~/.streamlit
|
| 2 |
+
|
| 3 |
+
echo "[server]
|
| 4 |
+
headless = true
|
| 5 |
+
port = $PORT
|
| 6 |
+
enableCORS = false
|
| 7 |
+
" > ~/.streamlit/config.toml
|