Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .env +1 -0
- README.md +1 -7
- demo.py +31 -0
- requirements.txt +93 -0
- tour_op2.xlsx +0 -0
.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
OPENAI_API_KEY="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"
|
README.md
CHANGED
|
@@ -1,12 +1,6 @@
|
|
| 1 |
---
|
| 2 |
title: ExponentoAi
|
| 3 |
-
|
| 4 |
-
colorFrom: indigo
|
| 5 |
-
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 4.1.2
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
title: ExponentoAi
|
| 3 |
+
app_file: demo.py
|
|
|
|
|
|
|
| 4 |
sdk: gradio
|
| 5 |
sdk_version: 4.1.2
|
|
|
|
|
|
|
| 6 |
---
|
|
|
|
|
|
demo.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
import gradio as gr
|
| 5 |
+
import io
|
| 6 |
+
from langchain.chains.question_answering import load_qa_chain
|
| 7 |
+
from langchain import PromptTemplate, LLMChain
|
| 8 |
+
from langchain_experimental.agents.agent_toolkits import create_pandas_dataframe_agent
|
| 9 |
+
from langchain.chat_models import ChatOpenAI
|
| 10 |
+
from langchain.agents.agent_types import AgentType
|
| 11 |
+
import pandas as pd
|
| 12 |
+
from langchain.llms import OpenAI
|
| 13 |
+
from dotenv import load_dotenv
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def questiondocument(user_question):
|
| 17 |
+
load_dotenv()
|
| 18 |
+
#
|
| 19 |
+
df = pd.read_excel("tour_op2.xlsx")
|
| 20 |
+
agent = create_pandas_dataframe_agent(OpenAI(temperature=0), df, openai_api_key = os.getenv('OPENAI_API_KEY'), verbose=True)
|
| 21 |
+
response = agent.run(user_question)
|
| 22 |
+
return response
|
| 23 |
+
|
| 24 |
+
demo = gr.Interface(
|
| 25 |
+
|
| 26 |
+
fn=questiondocument,
|
| 27 |
+
inputs=["text"],
|
| 28 |
+
outputs=["text"],
|
| 29 |
+
title="Ask BuzyHelper",
|
| 30 |
+
)
|
| 31 |
+
demo.launch(share=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aiofiles==23.2.1
|
| 2 |
+
aiohttp==3.8.6
|
| 3 |
+
aiosignal==1.3.1
|
| 4 |
+
altair==5.1.2
|
| 5 |
+
annotated-types==0.6.0
|
| 6 |
+
anyio==3.7.1
|
| 7 |
+
async-timeout==4.0.3
|
| 8 |
+
attrs==23.1.0
|
| 9 |
+
certifi==2023.7.22
|
| 10 |
+
charset-normalizer==3.3.2
|
| 11 |
+
click==8.1.7
|
| 12 |
+
colorama==0.4.6
|
| 13 |
+
contourpy==1.2.0
|
| 14 |
+
cycler==0.12.1
|
| 15 |
+
dataclasses-json==0.6.1
|
| 16 |
+
et-xmlfile==1.1.0
|
| 17 |
+
exceptiongroup==1.1.3
|
| 18 |
+
fastapi==0.104.1
|
| 19 |
+
ffmpy==0.3.1
|
| 20 |
+
filelock==3.13.1
|
| 21 |
+
fonttools==4.44.0
|
| 22 |
+
frozenlist==1.4.0
|
| 23 |
+
fsspec==2023.10.0
|
| 24 |
+
gradio==4.1.2
|
| 25 |
+
gradio_client==0.7.0
|
| 26 |
+
greenlet==3.0.1
|
| 27 |
+
h11==0.14.0
|
| 28 |
+
httpcore==1.0.1
|
| 29 |
+
httpx==0.25.1
|
| 30 |
+
huggingface-hub==0.19.0
|
| 31 |
+
idna==3.4
|
| 32 |
+
importlib-resources==6.1.1
|
| 33 |
+
iniconfig==2.0.0
|
| 34 |
+
Jinja2==3.1.2
|
| 35 |
+
jsonpatch==1.33
|
| 36 |
+
jsonpointer==2.4
|
| 37 |
+
jsonschema==4.19.2
|
| 38 |
+
jsonschema-specifications==2023.7.1
|
| 39 |
+
kiwisolver==1.4.5
|
| 40 |
+
langchain==0.0.332
|
| 41 |
+
langchain-experimental==0.0.39
|
| 42 |
+
langsmith==0.0.62
|
| 43 |
+
markdown-it-py==3.0.0
|
| 44 |
+
MarkupSafe==2.1.3
|
| 45 |
+
marshmallow==3.20.1
|
| 46 |
+
matplotlib==3.8.1
|
| 47 |
+
mdurl==0.1.2
|
| 48 |
+
multidict==6.0.4
|
| 49 |
+
mypy-extensions==1.0.0
|
| 50 |
+
numpy==1.26.1
|
| 51 |
+
openai==0.28.1
|
| 52 |
+
openpyxl==3.1.2
|
| 53 |
+
orjson==3.9.10
|
| 54 |
+
packaging==23.2
|
| 55 |
+
pandas==2.1.2
|
| 56 |
+
Pillow==10.1.0
|
| 57 |
+
pluggy==1.3.0
|
| 58 |
+
pydantic==2.4.2
|
| 59 |
+
pydantic_core==2.10.1
|
| 60 |
+
pydub==0.25.1
|
| 61 |
+
Pygments==2.16.1
|
| 62 |
+
pyparsing==3.1.1
|
| 63 |
+
pytest==7.4.3
|
| 64 |
+
pytest-subtests==0.11.0
|
| 65 |
+
python-dateutil==2.8.2
|
| 66 |
+
python-dotenv==1.0.0
|
| 67 |
+
python-multipart==0.0.6
|
| 68 |
+
pytz==2023.3.post1
|
| 69 |
+
PyYAML==6.0.1
|
| 70 |
+
referencing==0.30.2
|
| 71 |
+
requests==2.31.0
|
| 72 |
+
rich==13.6.0
|
| 73 |
+
rpds-py==0.12.0
|
| 74 |
+
semantic-version==2.10.0
|
| 75 |
+
shellingham==1.5.4
|
| 76 |
+
six==1.16.0
|
| 77 |
+
sniffio==1.3.0
|
| 78 |
+
SQLAlchemy==2.0.23
|
| 79 |
+
starlette==0.27.0
|
| 80 |
+
tabulate==0.9.0
|
| 81 |
+
tenacity==8.2.3
|
| 82 |
+
tomli==2.0.1
|
| 83 |
+
tomlkit==0.12.0
|
| 84 |
+
toolz==0.12.0
|
| 85 |
+
tqdm==4.66.1
|
| 86 |
+
typer==0.9.0
|
| 87 |
+
typing-inspect==0.9.0
|
| 88 |
+
typing_extensions==4.8.0
|
| 89 |
+
tzdata==2023.3
|
| 90 |
+
urllib3==2.0.7
|
| 91 |
+
uvicorn==0.24.0.post1
|
| 92 |
+
websockets==11.0.3
|
| 93 |
+
yarl==1.9.2
|
tour_op2.xlsx
ADDED
|
Binary file (97.5 kB). View file
|
|
|