Change Liao
commited on
Commit
·
e37f8aa
1
Parent(s):
48178af
first push everything from an existing project
Browse files- .aws/config +2 -0
- .aws/credentials +3 -0
- .gitattributes +1 -34
- .gitignore +5 -0
- README.md +94 -9
- __pycache__/azure_utils.cpython-310.pyc +0 -0
- __pycache__/polly_utils.cpython-310.pyc +0 -0
- app.py +765 -0
- azure_utils.py +155 -0
- cache.sqlite3 +0 -0
- data/audios/tempfile.mp3 +0 -0
- data/ks_source/.gitattributes +1 -0
- data/ks_source/110年07月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/110年08月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/110年09月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/110年10月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/110年11月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/110年12月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/111年01月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/111年02月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/111年03月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/111年04月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/111年05月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/111年06月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/111年07月MaaS交易資料-(例行).csv +3 -0
- data/ks_source/111年08月MaaS交易資料-(例行).csv +3 -0
- data/vector.png +0 -0
- data/videos/Masahiro.mp4 +0 -0
- data/videos/Masahiro1.mp4 +0 -0
- data/videos/tempfile.mp4 +0 -0
- poc_langchain.spec +50 -0
- polly_utils.py +635 -0
- requirements.txt +208 -0
- run_local_server.bat +2 -0
.aws/config
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[default]
|
2 |
+
region=us-east-1
|
.aws/credentials
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
[default]
|
2 |
+
aws_access_key_id = AKIAV7Q7AAGW54RBR6FZ
|
3 |
+
aws_secret_access_key = tLcT5skkHApXeWzNGuj9qkrecIhX+XVAyOSdhvzd
|
.gitattributes
CHANGED
@@ -1,34 +1 @@
|
|
1 |
-
*.
|
2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
1 |
+
*.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/.idea/
|
3 |
+
venv/*
|
4 |
+
data_source/*
|
5 |
+
.git_foxconn/*
|
README.md
CHANGED
@@ -1,13 +1,98 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji: 📉
|
4 |
-
colorFrom: yellow
|
5 |
-
colorTo: yellow
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.35.2
|
8 |
app_file: app.py
|
9 |
-
|
10 |
-
|
11 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
|
|
|
1 |
---
|
2 |
+
title: azure_openai_poc
|
|
|
|
|
|
|
|
|
|
|
3 |
app_file: app.py
|
4 |
+
sdk: gradio
|
5 |
+
sdk_version: 3.34.0
|
6 |
---
|
7 |
+
# azure_openai_poc
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
## Getting started
|
12 |
+
|
13 |
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
14 |
+
|
15 |
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
16 |
+
|
17 |
+
## Add your files
|
18 |
+
|
19 |
+
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
20 |
+
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
21 |
+
|
22 |
+
```
|
23 |
+
cd existing_repo
|
24 |
+
git remote add origin https://devops.foxconn.com/16408/azure_openai_poc.git
|
25 |
+
git branch -M main
|
26 |
+
git push -uf origin main
|
27 |
+
```
|
28 |
+
|
29 |
+
## Integrate with your tools
|
30 |
+
|
31 |
+
- [ ] [Set up project integrations](https://devops.foxconn.com/16408/azure_openai_poc/-/settings/integrations)
|
32 |
+
|
33 |
+
## Collaborate with your team
|
34 |
+
|
35 |
+
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
36 |
+
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
37 |
+
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
38 |
+
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
39 |
+
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
40 |
+
|
41 |
+
## Test and Deploy
|
42 |
+
|
43 |
+
Use the built-in continuous integration in GitLab.
|
44 |
+
|
45 |
+
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
46 |
+
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
47 |
+
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
48 |
+
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
49 |
+
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
50 |
+
|
51 |
+
***
|
52 |
+
|
53 |
+
# Editing this README
|
54 |
+
|
55 |
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
56 |
+
|
57 |
+
## Suggestions for a good README
|
58 |
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
59 |
+
|
60 |
+
## Name
|
61 |
+
Choose a self-explaining name for your project.
|
62 |
+
|
63 |
+
## Description
|
64 |
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
65 |
+
|
66 |
+
## Badges
|
67 |
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
68 |
+
|
69 |
+
## Visuals
|
70 |
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
71 |
+
|
72 |
+
## Installation
|
73 |
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
74 |
+
|
75 |
+
## Usage
|
76 |
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
77 |
+
|
78 |
+
## Support
|
79 |
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
80 |
+
|
81 |
+
## Roadmap
|
82 |
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
83 |
+
|
84 |
+
## Contributing
|
85 |
+
State if you are open to contributions and what your requirements are for accepting them.
|
86 |
+
|
87 |
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
88 |
+
|
89 |
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
90 |
+
|
91 |
+
## Authors and acknowledgment
|
92 |
+
Show your appreciation to those who have contributed to the project.
|
93 |
+
|
94 |
+
## License
|
95 |
+
For open source projects, say how it is licensed.
|
96 |
|
97 |
+
## Project status
|
98 |
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
__pycache__/azure_utils.cpython-310.pyc
ADDED
Binary file (3.07 kB). View file
|
|
__pycache__/polly_utils.cpython-310.pyc
ADDED
Binary file (6.95 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,765 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import datetime
|
3 |
+
import glob
|
4 |
+
import shutil
|
5 |
+
import requests
|
6 |
+
import io
|
7 |
+
import sys
|
8 |
+
import re
|
9 |
+
import boto3
|
10 |
+
from os import listdir
|
11 |
+
from os.path import isfile, join
|
12 |
+
|
13 |
+
import gradio
|
14 |
+
from sqlitedict import SqliteDict
|
15 |
+
|
16 |
+
import gradio as gr
|
17 |
+
|
18 |
+
from langchain.llms import AzureOpenAI
|
19 |
+
from langchain.chat_models import AzureChatOpenAI
|
20 |
+
|
21 |
+
from langchain.embeddings.openai import OpenAIEmbeddings
|
22 |
+
from langchain.chains import ConversationalRetrievalChain
|
23 |
+
|
24 |
+
from langchain.memory import ChatMessageHistory
|
25 |
+
from langchain import PromptTemplate
|
26 |
+
from langchain.vectorstores import Chroma
|
27 |
+
|
28 |
+
from langchain.text_splitter import CharacterTextSplitter
|
29 |
+
from langchain.memory import ConversationBufferMemory
|
30 |
+
from langchain.document_loaders import DirectoryLoader
|
31 |
+
|
32 |
+
from langchain.document_loaders import UnstructuredFileLoader
|
33 |
+
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
34 |
+
from langchain.chains.summarize import load_summarize_chain
|
35 |
+
|
36 |
+
import clickhouse_connect
|
37 |
+
from pathlib import Path
|
38 |
+
|
39 |
+
from langchain.document_loaders import YoutubeLoader
|
40 |
+
|
41 |
+
from azure_utils import AzureVoiceData
|
42 |
+
from polly_utils import PollyVoiceData, NEURAL_ENGINE
|
43 |
+
from contextlib import closing
|
44 |
+
|
45 |
+
#os env
|
46 |
+
os.environ["OPENAI_API_TYPE"] = "azure"
|
47 |
+
os.environ["OPENAI_API_VERSION"] = "2023-03-15-preview"
|
48 |
+
os.environ["OPENAI_API_BASE"] = "https://civet-project-001.openai.azure.com/"
|
49 |
+
os.environ["OPENAI_API_KEY"] = "0e3e5b666818488fa1b5cb4e4238ffa7"
|
50 |
+
global_deployment_id = "CivetGPT"
|
51 |
+
global_model_name = "gpt-35-turbo"
|
52 |
+
|
53 |
+
#chroma settings
|
54 |
+
chroma_api_impl = "HH_Azure_Openai"
|
55 |
+
#root_file_path = "C:\\Users\\catsk\\SourceCode\\azure_openai_poc\\data\\"
|
56 |
+
root_file_path = "./data/" #其實是data 存放的位置
|
57 |
+
hr_source_path = "hr_source"
|
58 |
+
ks_source_path = "ks_source"
|
59 |
+
|
60 |
+
sqlite_name = "cache.sqlite3"
|
61 |
+
sqlite_key="stored_files"
|
62 |
+
persist_db = "persist_db"
|
63 |
+
hr_collection_name = "hr_db"
|
64 |
+
chroma_db_impl="localdb+langchain"
|
65 |
+
tmp_collection="tmp_collection"
|
66 |
+
|
67 |
+
#global text setting
|
68 |
+
inputText = "問題(按q 或Ctrl + c跳出): "
|
69 |
+
refuse_string="服務被拒. 內容可能涉及敏感字詞,政治,煽動他人或是其他不當言詞, 請改以其他內容嚐試"
|
70 |
+
|
71 |
+
#video
|
72 |
+
LOOPING_TALKING_HEAD = "./data/videos/Masahiro.mp4"
|
73 |
+
TALKING_HEAD_WIDTH = "192"
|
74 |
+
AZURE_VOICE_DATA = AzureVoiceData()
|
75 |
+
POLLY_VOICE_DATA = PollyVoiceData()
|
76 |
+
|
77 |
+
|
78 |
+
def save_sqlite(key,value):
|
79 |
+
try:
|
80 |
+
with SqliteDict(sqlite_name) as mydict:
|
81 |
+
old_value = mydict[key]
|
82 |
+
mydict[key] = value+old_value # Using dict[key] to store
|
83 |
+
mydict.commit() # Need to commit() to actually flush the data
|
84 |
+
except Exception as ex:
|
85 |
+
print("Error during storing data (Possibly unsupported):", ex)
|
86 |
+
|
87 |
+
def load_sqlite(key):
|
88 |
+
try:
|
89 |
+
with SqliteDict(sqlite_name) as mydict:
|
90 |
+
value = mydict[key] # No need to use commit(), since we are only loading data!
|
91 |
+
return value
|
92 |
+
except Exception as ex:
|
93 |
+
print("Error during loading data:", ex)
|
94 |
+
|
95 |
+
def delete_sql(key):
|
96 |
+
try:
|
97 |
+
with SqliteDict(sqlite_name) as mydict:
|
98 |
+
mydict[key] = [] # Using dict[key] to store
|
99 |
+
mydict.commit() # Need to commit() to actually flush the data
|
100 |
+
except Exception as ex:
|
101 |
+
print("Error during storing data (Possibly unsupported):", ex)
|
102 |
+
|
103 |
+
def ai_answer(answer):
|
104 |
+
print('AI 回答: \033[32m' + answer +'\033[0m')
|
105 |
+
|
106 |
+
def get_openaiembeddings():
|
107 |
+
return OpenAIEmbeddings(
|
108 |
+
deployment="CivetGPT_embedding",
|
109 |
+
model="text-embedding-ada-002",
|
110 |
+
#embed_batch_size=1
|
111 |
+
chunk_size=1
|
112 |
+
)
|
113 |
+
|
114 |
+
"""
|
115 |
+
def get_chroma_client():
|
116 |
+
chroma_client = chromadb.Client(Settings(chroma_api_impl=chroma_api_impl,
|
117 |
+
chroma_server_host=chroma_db_ip,
|
118 |
+
chroma_server_http_port=chroma_db_port
|
119 |
+
))
|
120 |
+
return chroma_client
|
121 |
+
"""
|
122 |
+
|
123 |
+
def multidocs_loader(files_path, file_ext):
|
124 |
+
full_files_pattern = "*." + file_ext
|
125 |
+
loader = DirectoryLoader(files_path, glob=full_files_pattern, show_progress=True)
|
126 |
+
data = loader.load()
|
127 |
+
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=10)
|
128 |
+
documents = text_splitter.split_documents(data)
|
129 |
+
return documents
|
130 |
+
|
131 |
+
def unstructure_file_loader(filename_path):
|
132 |
+
loader = UnstructuredFileLoader(filename_path)
|
133 |
+
data = loader.load()
|
134 |
+
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=10)
|
135 |
+
documents = text_splitter.split_documents(data)
|
136 |
+
return documents
|
137 |
+
|
138 |
+
def add_documents_into_cromadb(db_name, file_path, collection_name):
|
139 |
+
_db_name = db_name
|
140 |
+
|
141 |
+
documents = multidocs_loader(file_path,"*")
|
142 |
+
embeddings = get_openaiembeddings()
|
143 |
+
|
144 |
+
chroma_db = Chroma.from_documents(
|
145 |
+
documents,
|
146 |
+
embeddings,
|
147 |
+
collection_name=collection_name,
|
148 |
+
persist_directory=root_file_path+ persist_db,
|
149 |
+
chroma_db_impl=chroma_db_impl
|
150 |
+
)
|
151 |
+
|
152 |
+
chroma_db.persist()
|
153 |
+
print('adding documents done!')
|
154 |
+
|
155 |
+
def initial_croma_db(db_name, files_path, file_ext, collection_name):
|
156 |
+
_db_name = db_name
|
157 |
+
|
158 |
+
documents = multidocs_loader(files_path, file_ext)
|
159 |
+
embeddings = get_openaiembeddings()
|
160 |
+
|
161 |
+
chroma_db = Chroma.from_documents(
|
162 |
+
documents,
|
163 |
+
embeddings,
|
164 |
+
collection_name = collection_name,
|
165 |
+
persist_directory= root_file_path+ persist_db,
|
166 |
+
chroma_db_impl=chroma_db_impl
|
167 |
+
)
|
168 |
+
|
169 |
+
chroma_db.persist()
|
170 |
+
print('vectorstore done!')
|
171 |
+
|
172 |
+
def add_files_to_collection(input_file_path, collection_name):
|
173 |
+
file_path=root_file_path+input_file_path
|
174 |
+
add_documents_into_cromadb(persist_db, file_path, collection_name)
|
175 |
+
|
176 |
+
def get_prompt_summary_string():
|
177 |
+
return """使用中文替下面內容做個精簡摘要:
|
178 |
+
|
179 |
+
{text}
|
180 |
+
|
181 |
+
精簡摘要:"""
|
182 |
+
|
183 |
+
|
184 |
+
def get_prompt_template_string():
|
185 |
+
today = datetime.date.today().strftime("%Y年%m月%d日")
|
186 |
+
template_string = f"我是鴻海的員工, 你是一個超級助理. 今天是{today}".format(today=today)+"""
|
187 |
+
請根據歷史對話,針對這次的問題, 形成獨立問題並以中文作回答. 請優先從提供的文件中尋找答案, 你被允許回答不知道, 但回答不知道時需要給中央人資的客服聯絡窗口資訊.
|
188 |
+
不論什麼問題, 都以中文回答
|
189 |
+
|
190 |
+
歷史對話: {chat_history}
|
191 |
+
這次的問題: {question}
|
192 |
+
超級助理:
|
193 |
+
"""
|
194 |
+
return template_string
|
195 |
+
|
196 |
+
def get_default_template_prompt():
|
197 |
+
template = "你是個知識廣泛的超級助手, 以下所有問題請用中文回答, 並請在500個中文字以內來解釋 {concept} 概念"
|
198 |
+
prompt = PromptTemplate(
|
199 |
+
input_variables = ["concept"],
|
200 |
+
template = template
|
201 |
+
)
|
202 |
+
|
203 |
+
return prompt
|
204 |
+
|
205 |
+
def fine_tuning_model_chat(my_deployment_id, my_model_name):
|
206 |
+
_prompt = get_default_template_prompt()
|
207 |
+
llm = AzureOpenAI(model_name=my_model_name, deployment_name = my_deployment_id)
|
208 |
+
while 1:
|
209 |
+
text = input(inputText)
|
210 |
+
if text == 'q':
|
211 |
+
break
|
212 |
+
response = llm(_prompt.format(concept = text))
|
213 |
+
ai_answer(response)
|
214 |
+
|
215 |
+
def chat_conversation():
|
216 |
+
print("resource: " + global_deployment_id + " / " + global_model_name)
|
217 |
+
chat = AzureChatOpenAI(
|
218 |
+
deployment_name = global_deployment_id,
|
219 |
+
model_name = global_model_name,
|
220 |
+
)
|
221 |
+
|
222 |
+
history = ChatMessageHistory()
|
223 |
+
history.add_ai_message("你是一個超級助理, 以下問題都用中文回答")
|
224 |
+
while 1:
|
225 |
+
text = input(inputText)
|
226 |
+
if text == 'q':
|
227 |
+
break
|
228 |
+
history.add_user_message(text)
|
229 |
+
ai_response = chat(history.messages)
|
230 |
+
ai_answer(ai_response.content)
|
231 |
+
|
232 |
+
def local_vector_search(question_str,chat_history, collection_name = hr_collection_name):
|
233 |
+
embedding = get_openaiembeddings()
|
234 |
+
vectorstore = Chroma( embedding_function=embedding,
|
235 |
+
collection_name=collection_name,
|
236 |
+
persist_directory=root_file_path+persist_db,
|
237 |
+
)
|
238 |
+
|
239 |
+
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True, ai_prefix = "AI超級助理")
|
240 |
+
|
241 |
+
llm = AzureChatOpenAI(
|
242 |
+
deployment_name = global_deployment_id,
|
243 |
+
model_name= global_model_name,
|
244 |
+
temperature = 0.2)
|
245 |
+
|
246 |
+
prompt = PromptTemplate(
|
247 |
+
template=get_prompt_template_string(),
|
248 |
+
input_variables=["question","chat_history"]
|
249 |
+
)
|
250 |
+
prompt.format(question=question_str,chat_history=chat_history)
|
251 |
+
chain = ConversationalRetrievalChain.from_llm(
|
252 |
+
llm=llm,
|
253 |
+
retriever=vectorstore.as_retriever(),
|
254 |
+
memory=memory,
|
255 |
+
condense_question_prompt=prompt,
|
256 |
+
)
|
257 |
+
result = chain({"question": question_str, "chat_history":chat_history})
|
258 |
+
return result["answer"]
|
259 |
+
|
260 |
+
def make_markdown_table(array):
|
261 |
+
nl = "\n"
|
262 |
+
markdown = ""
|
263 |
+
for entry in array:
|
264 |
+
markdown += f"{entry} {nl}"
|
265 |
+
return markdown
|
266 |
+
|
267 |
+
def get_hr_files():
|
268 |
+
files = load_sqlite(sqlite_key)
|
269 |
+
if files == None:
|
270 |
+
return
|
271 |
+
else:
|
272 |
+
return make_markdown_table(files)
|
273 |
+
|
274 |
+
def update_hr_km(files):
|
275 |
+
file_paths = [file.name for file in files]
|
276 |
+
dest_file_path=root_file_path+hr_source_path
|
277 |
+
if not os.path.exists(dest_file_path):
|
278 |
+
os.makedirs(dest_file_path)
|
279 |
+
|
280 |
+
for file in file_paths:
|
281 |
+
shutil.copy(file, dest_file_path)
|
282 |
+
add_files_to_collection(hr_source_path, hr_collection_name)
|
283 |
+
|
284 |
+
save_sqlite(sqlite_key, [Path(file_path).name for file_path in file_paths])
|
285 |
+
return get_hr_files()
|
286 |
+
|
287 |
+
def clear_all_collection(collection_name):
|
288 |
+
pass
|
289 |
+
|
290 |
+
def all_files_under_diretory(path):
|
291 |
+
files = glob.glob(path+'\*')
|
292 |
+
for f in files:
|
293 |
+
os.remove(f)
|
294 |
+
|
295 |
+
def clear_hr_datas():
|
296 |
+
#remove hr collection
|
297 |
+
client = get_chroma_client(hr_collection_name)
|
298 |
+
client.delete_collection(name=hr_collection_name)
|
299 |
+
print("Collection removed completely!")
|
300 |
+
|
301 |
+
#remove files
|
302 |
+
all_files_under_diretory(root_file_path+hr_source_path)
|
303 |
+
delete_sql(sqlite_key)
|
304 |
+
return get_hr_files()
|
305 |
+
|
306 |
+
def num_of_collection(collection_name):
|
307 |
+
client = get_chroma_client(collection_name)
|
308 |
+
number = client.get_collection(collection_name).count()
|
309 |
+
return f"目前知識卷裡有{number}卷項目"
|
310 |
+
|
311 |
+
|
312 |
+
def clear_tmp_collection():
|
313 |
+
client = get_chroma_client(tmp_collection)
|
314 |
+
client.delete_collection(name=tmp_collection)
|
315 |
+
all_files_under_diretory(root_file_path+ks_source_path)
|
316 |
+
return num_of_collection(tmp_collection)
|
317 |
+
|
318 |
+
def content_summary(split_documents):
|
319 |
+
llm = AzureChatOpenAI(
|
320 |
+
deployment_name=global_deployment_id,
|
321 |
+
model_name=global_model_name,
|
322 |
+
temperature=0.2)
|
323 |
+
map_prompt = get_prompt_summary_string()
|
324 |
+
map_prompt_template = PromptTemplate(template=map_prompt, input_variables=["text"])
|
325 |
+
chain = load_summarize_chain(
|
326 |
+
llm=llm,
|
327 |
+
chain_type="map_reduce",
|
328 |
+
verbose=True,
|
329 |
+
map_prompt=map_prompt_template,
|
330 |
+
combine_prompt=map_prompt_template
|
331 |
+
)
|
332 |
+
try:
|
333 |
+
output = chain({"input_documents": split_documents}, return_only_outputs=True)
|
334 |
+
return output
|
335 |
+
except Exception as e:
|
336 |
+
print(e)
|
337 |
+
return {'output_text':refuse_string}
|
338 |
+
|
339 |
+
def pdf_summary(file_name):
|
340 |
+
print("file_name: "+file_name)
|
341 |
+
loader = UnstructuredFileLoader(file_name)
|
342 |
+
document = loader.load()
|
343 |
+
text_splitter = RecursiveCharacterTextSplitter(
|
344 |
+
chunk_size=1000,
|
345 |
+
chunk_overlap=20
|
346 |
+
)
|
347 |
+
split_documents = text_splitter.split_documents(document)
|
348 |
+
return content_summary(split_documents)
|
349 |
+
|
350 |
+
def youtube_summary(youtube_url):
|
351 |
+
loader=YoutubeLoader.from_youtube_url(youtube_url, add_video_info=True, language=['en','zh-TW'], translation='zh-TW')
|
352 |
+
document=loader.load()
|
353 |
+
text_splitter=CharacterTextSplitter(chunk_size=1000, chunk_overlap=10)
|
354 |
+
split_documents=text_splitter.split_documents(document)
|
355 |
+
result = content_summary(split_documents)
|
356 |
+
return result['output_text']
|
357 |
+
def summary_large_file(files):
|
358 |
+
file_paths = [file.name for file in files]
|
359 |
+
print(file_paths[0])
|
360 |
+
result = pdf_summary(file_paths[0])
|
361 |
+
return result["output_text"]
|
362 |
+
|
363 |
+
def upload_large_file(files):
|
364 |
+
file_paths = [file.name for file in files]
|
365 |
+
return Path(file_paths[0]).stem
|
366 |
+
|
367 |
+
def set_allow_lightweight_delete():
|
368 |
+
client = clickhouse_connect.get_client(host='127.0.0.1',port=8123)
|
369 |
+
command = "SET allow_experimental_lightweight_delete = true;"
|
370 |
+
#command = "show databases;"
|
371 |
+
res=client.command(command)
|
372 |
+
print(res)
|
373 |
+
def get_chroma_client(collection_name):
|
374 |
+
vectorstore = Chroma(
|
375 |
+
embedding_function=get_openaiembeddings(),
|
376 |
+
collection_name=collection_name,
|
377 |
+
persist_directory= root_file_path+persist_db,
|
378 |
+
)
|
379 |
+
return vectorstore._client
|
380 |
+
|
381 |
+
def create_db():
|
382 |
+
files_path = root_file_path+hr_source_path
|
383 |
+
file_ext = "pdf"
|
384 |
+
initial_croma_db(persist_db, files_path, file_ext, hr_collection_name)
|
385 |
+
|
386 |
+
def generate_iframe_for_youtube(youtube_link):
|
387 |
+
regex = r"(?:https:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)"
|
388 |
+
_url=re.sub(regex, r"https://www.youtube.com/embed/\1", youtube_link)
|
389 |
+
embed_html = f'<iframe width="650" height="365" src="{_url}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
390 |
+
print(embed_html)
|
391 |
+
return embed_html
|
392 |
+
|
393 |
+
def create_html_video(file_name, width, temp_file_url):
|
394 |
+
html_video = f'<video width={width} height={width} autoplay muted loop><source src={temp_file_url} type="video/mp4" poster="Masahiro.png"></video>'
|
395 |
+
return html_video
|
396 |
+
|
397 |
+
def do_html_audio_speak(words_to_speak):
|
398 |
+
polly_client = boto3.Session(
|
399 |
+
aws_access_key_id="AKIAV7Q7AAGW54RBR6FZ",
|
400 |
+
aws_secret_access_key="tLcT5skkHApXeWzNGuj9qkrecIhX+XVAyOSdhvzd",
|
401 |
+
region_name='us-west-2'
|
402 |
+
).client('polly')
|
403 |
+
|
404 |
+
language_code="cmn-CN"
|
405 |
+
engine = NEURAL_ENGINE
|
406 |
+
voice_id = "Zhiyu"
|
407 |
+
|
408 |
+
print("voice_id: "+voice_id+"\nlanguage_code="+language_code)
|
409 |
+
response = polly_client.synthesize_speech(
|
410 |
+
Text=words_to_speak,
|
411 |
+
OutputFormat='mp3',
|
412 |
+
VoiceId=voice_id,
|
413 |
+
LanguageCode=language_code,
|
414 |
+
Engine=engine
|
415 |
+
)
|
416 |
+
|
417 |
+
html_audio = '<pre>no audio</pre>'
|
418 |
+
|
419 |
+
# Save the audio stream returned by Amazon Polly on Lambda's temp directory
|
420 |
+
if "AudioStream" in response:
|
421 |
+
with closing(response["AudioStream"]) as stream:
|
422 |
+
try:
|
423 |
+
with open('./data/audios/tempfile.mp3', 'wb') as f:
|
424 |
+
f.write(stream.read())
|
425 |
+
temp_aud_file = gr.File("./data/audios/tempfile.mp3")
|
426 |
+
temp_aud_file_url = "/file=" + temp_aud_file.value['name']
|
427 |
+
html_audio = f'<audio autoplay><source src={temp_aud_file_url} type="audio/mp3"></audio>'
|
428 |
+
except IOError as error:
|
429 |
+
# Could not write to file, exit gracefully
|
430 |
+
print(error)
|
431 |
+
return None, None
|
432 |
+
else:
|
433 |
+
# The response didn't contain audio data, exit gracefully
|
434 |
+
print("Could not stream audio")
|
435 |
+
return None, None
|
436 |
+
|
437 |
+
return html_audio, "./data/audios/tempfile.mp3"
|
438 |
+
|
439 |
+
def do_html_video_speak():
|
440 |
+
|
441 |
+
key = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6ImNhdHNreXR3QGdtYWlsLmNvbSJ9.OypOUZF-xv4-b8i9F4_aaMQiJpxv0mXRT5kyuJwTMXVd4awV-O-Obntp--AqGghNNowzQ9oG7zArSnQjz2vQgg"
|
442 |
+
url = "https://api.exh.ai/animations/v2/generate_lipsync_from_audio"
|
443 |
+
files = {"audio_file": ("./data/audios/tempfile.mp3", open("./data/audios/tempfile.mp3", "rb"), "audio/mpeg")}
|
444 |
+
payload = {
|
445 |
+
"animation_pipeline": "high_quality",
|
446 |
+
"idle_url": "https://ugc-idle.s3-us-west-2.amazonaws.com/5fd9ba1b1607b39a4d559300c1e35bee.mp4"
|
447 |
+
}
|
448 |
+
headers = {
|
449 |
+
"accept": "application/json",
|
450 |
+
"authorization": f"Bearer {key}"
|
451 |
+
}
|
452 |
+
|
453 |
+
res = requests.post(url, data=payload, files=files, headers=headers)
|
454 |
+
|
455 |
+
print("res.status_code: ", res.status_code)
|
456 |
+
|
457 |
+
html_video = '<pre>no video</pre>'
|
458 |
+
if isinstance(res.content, bytes):
|
459 |
+
response_stream = io.BytesIO(res.content)
|
460 |
+
print("len(res.content)): ", len(res.content))
|
461 |
+
|
462 |
+
with open('./data/videos/tempfile.mp4', 'wb') as f:
|
463 |
+
f.write(response_stream.read())
|
464 |
+
temp_file = gr.File("./data/videos/tempfile.mp4")
|
465 |
+
temp_file_url = "/file=" + temp_file.value['name']
|
466 |
+
html_video = f'<video width={TALKING_HEAD_WIDTH} height={TALKING_HEAD_WIDTH} autoplay><source src={temp_file_url} type="video/mp4" poster="Masahiro.png"></video>'
|
467 |
+
else:
|
468 |
+
print('video url unknown')
|
469 |
+
return res, html_video, "./data/videos/tempfile.mp4"
|
470 |
+
|
471 |
+
def kh_update_km(files):
|
472 |
+
file_paths = [file.name for file in files]
|
473 |
+
dest_file_path = root_file_path + ks_source_path
|
474 |
+
|
475 |
+
if not os.path.exists(dest_file_path):
|
476 |
+
os.makedirs(dest_file_path)
|
477 |
+
|
478 |
+
for file in file_paths:
|
479 |
+
shutil.copy(file, dest_file_path)
|
480 |
+
add_files_to_collection(ks_source_path, tmp_collection)
|
481 |
+
|
482 |
+
return num_of_collection(tmp_collection)
|
483 |
+
|
484 |
+
|
485 |
+
class Logger:
|
486 |
+
def __init__(self, filename):
|
487 |
+
self.terminal = sys.stdout
|
488 |
+
self.log = open(filename, "w", encoding='UTF-8')
|
489 |
+
|
490 |
+
def write(self, message):
|
491 |
+
self.terminal.write(message)
|
492 |
+
self.log.write(message)
|
493 |
+
|
494 |
+
def flush(self):
|
495 |
+
self.terminal.flush()
|
496 |
+
self.log.flush()
|
497 |
+
|
498 |
+
def isatty(self):
|
499 |
+
return False
|
500 |
+
|
501 |
+
|
502 |
+
def read_logs():
|
503 |
+
sys.stdout.flush()
|
504 |
+
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
505 |
+
|
506 |
+
with open("output.log", "r", encoding='UTF-8') as f:
|
507 |
+
return ansi_escape.sub('', f.read())
|
508 |
+
|
509 |
+
|
510 |
+
def lunch_style(demo, logs=gr.Text()):
|
511 |
+
sys.stdout = Logger("output.log")
|
512 |
+
demo.load(read_logs, None, logs, every=1)
|
513 |
+
|
514 |
+
if len(sys.argv)==1:
|
515 |
+
print("running server as default value")
|
516 |
+
demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path])
|
517 |
+
elif len(sys.argv)==2 and sys.argv[1] == "server":
|
518 |
+
local_ip = "10.40.23.232"
|
519 |
+
local_port = 7788
|
520 |
+
print(f"running server on http://{local_ip}:{local_port}")
|
521 |
+
demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path],auth=("Foxconn", "Foxconn123!"),server_name=local_ip, server_port=local_port)
|
522 |
+
elif len(sys.argv)==4:
|
523 |
+
local_ip = sys.argv[2]
|
524 |
+
local_port = sys.argv[3]
|
525 |
+
print(f"running server on http://{local_ip}:{local_port}")
|
526 |
+
demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path],auth=("Foxconn", "Foxconn123!"),server_name=local_ip, server_port=local_port)
|
527 |
+
else:
|
528 |
+
print("syntax: pythong <your_app>.py [server {ip_address, port}] ")
|
529 |
+
|
530 |
+
def gradio_run():
|
531 |
+
print("User Login")
|
532 |
+
with gr.Blocks(theme='bethecloud/storj_theme') as demo:
|
533 |
+
|
534 |
+
with gr.Row():
|
535 |
+
gr.Markdown("# HH Azure Openai Demo")
|
536 |
+
#Header section
|
537 |
+
with gr.Row():
|
538 |
+
with gr.Column(scale=1):
|
539 |
+
gr.Markdown("""
|
540 |
+
### 這是一個基於各場景製造的Azure Openai Demo, 目前預計會包含場景有:
|
541 |
+
|
542 |
+
- 超長文本的摘要 ☑
|
543 |
+
- HR 智能客服小幫手 ☑
|
544 |
+
- 上傳過去歷史資料, 預測未來發展
|
545 |
+
- 上傳初步構想後, AI生成方案
|
546 |
+
- 網路上搜尋各式資料(包含google, wikipedia, youtube) 等, 綜合分析給結論
|
547 |
+
|
548 |
+
### 基礎的技術架構:
|
549 |
+
* 給予資料, 持續累加
|
550 |
+
* 存入vector(向量化) database, 依不同的collection 存放
|
551 |
+
* 問題以相似度(Similarity search), 結果再丟給gpt 做綜合回應
|
552 |
+
|
553 |
+
### 已知bug:
|
554 |
+
* N/A
|
555 |
+
|
556 |
+
如有任何Bug 歡迎隨時回饋
|
557 |
+
""")
|
558 |
+
with gr.Column(scale=1):
|
559 |
+
gr.Image(type="pil", value=root_file_path+"vector.png", label="技術概念圖")
|
560 |
+
gr.Markdown("""
|
561 |
+
> 中央資訊 Change Liao(廖晨志)
|
562 |
+
> teams/email: change.cc.liao@foxconn.com
|
563 |
+
> 分機: 5010108
|
564 |
+
""")
|
565 |
+
with gr.Row():
|
566 |
+
gr.Markdown("""
|
567 |
+
------
|
568 |
+
## Playground
|
569 |
+
請切換下方Tab 鍵試驗各項功能
|
570 |
+
|
571 |
+
""")
|
572 |
+
#First PoC Section
|
573 |
+
with gr.Tab("文本摘要"):
|
574 |
+
with gr.Row():
|
575 |
+
with gr.Column(scale=1):
|
576 |
+
gr.Markdown(f"""
|
577 |
+
## 第一項實驗: 超長文本摘要
|
578 |
+
請上傳任何文檔(.pdf, .doc, .csv, text 格式),上傳完成後稍等一會, AI 會在右側TextField 提供文本摘要
|
579 |
+
|
580 |
+
* 使用方式:
|
581 |
+
* 請在右邊按下 `請上傳超長文本(可接受text, pdf, doc, csv 格式)` 上傳你的文本
|
582 |
+
* AI 會開始解析內容, 檔案愈大解析愈久
|
583 |
+
* 上傳完後可以按同個按鍵, 再次上傳
|
584 |
+
* 後續會支援video 以及 audio格式
|
585 |
+
|
586 |
+
""")
|
587 |
+
|
588 |
+
with gr.Column(scale=1):
|
589 |
+
gr.Markdown("1.")
|
590 |
+
file_name_field = gr.Textbox(max_lines=1, label="上傳檔案",placeholder="目前沒有上傳檔案")
|
591 |
+
upload_button = gr.UploadButton("請上傳超長文本(可接受text, pdf, doc, csv 格式)",
|
592 |
+
file_types=["text", ".pdf", ".doc", ".csv"], file_count="multiple")
|
593 |
+
gr.Markdown("2.")
|
594 |
+
summary_text = gr.Textbox()
|
595 |
+
summary_text.label = "AI 摘要:"
|
596 |
+
summary_text.change = False
|
597 |
+
summary_text.lines = 12
|
598 |
+
upload_button.upload(upload_large_file, upload_button, file_name_field).then(summary_large_file,upload_button,summary_text)
|
599 |
+
#2nd Hr Section
|
600 |
+
with gr.Tab("HR 客服助手"):
|
601 |
+
with gr.Row():
|
602 |
+
with gr.Column(scale=1):
|
603 |
+
gr.Markdown(
|
604 |
+
"""
|
605 |
+
## 第二項實驗: HR 資料庫智能客服助手 AI 試驗
|
606 |
+
"""
|
607 |
+
)
|
608 |
+
gr.Markdown("""
|
609 |
+
### 使用方法
|
610 |
+
* 測試人員可在下方加入任何HR 相關資料, 亦可全部刪除後上傳.
|
611 |
+
* 系統會將資料向量化後,納入右方人資客服機器人資料庫
|
612 |
+
* 測試人員可在右方與客服機器人對話
|
613 |
+
|
614 |
+
(溫馨提醒: 儘可能所有檔案全部清掉, 再一次上傳所有想納入的檔案;且次數不要太多,以節省經費)
|
615 |
+
""")
|
616 |
+
file_list=gr.Textbox(get_hr_files, label="已存在知識庫的檔案(text,pdf,doc,csv)", placeholder="沒有任何檔案存在", max_lines=16, lines=16)
|
617 |
+
with gr.Row():
|
618 |
+
with gr.Column(scale=1):
|
619 |
+
upload_button = gr.UploadButton("上傳HR知識庫檔案",
|
620 |
+
file_types=["text", ".pdf", ".doc", ".csv"], file_count="multiple")
|
621 |
+
upload_button.upload(update_hr_km, inputs=upload_button, outputs=file_list)
|
622 |
+
with gr.Column(scale=1):
|
623 |
+
cleanDataBtn = gr.Button(value="刪除所有知識以及檔案")
|
624 |
+
cleanDataBtn.click(clear_hr_datas,outputs=file_list)
|
625 |
+
|
626 |
+
with gr.Column(scale=1):
|
627 |
+
with gr.Row():
|
628 |
+
with gr.Column():
|
629 |
+
tmp_file = gr.File(LOOPING_TALKING_HEAD, visible=False)
|
630 |
+
tmp_file_url = "/file=" + tmp_file.value['name']
|
631 |
+
htm_video = create_html_video(LOOPING_TALKING_HEAD, TALKING_HEAD_WIDTH, tmp_file_url)
|
632 |
+
video_html = gr.HTML(htm_video)
|
633 |
+
|
634 |
+
# my_aud_file = gr.File(label="Audio file", type="file", visible=True)
|
635 |
+
tmp_aud_file = gr.File("./data/audios/tempfile.mp3", visible=False)
|
636 |
+
tmp_aud_file_url = "/file=" + tmp_aud_file.value['name']
|
637 |
+
htm_audio = f'<audio><source src={tmp_aud_file_url} type="audio/mp3"></audio>'
|
638 |
+
audio_html = gr.HTML(htm_audio, visible=False)
|
639 |
+
def respond(message, chat_history):
|
640 |
+
vector_search_message = local_vector_search(message, chat_history)
|
641 |
+
chat_history.append((message, vector_search_message))
|
642 |
+
|
643 |
+
html_audio, audio_file_path = do_html_audio_speak(vector_search_message)
|
644 |
+
res, new_html_video, video_file_path = do_html_video_speak()
|
645 |
+
|
646 |
+
if res.status_code == 200:
|
647 |
+
return '', chat_history, new_html_video, ''
|
648 |
+
else:
|
649 |
+
return '', chat_history, htm_video, html_audio
|
650 |
+
with gr.Column():
|
651 |
+
gr.Markdown("""
|
652 |
+
### AI 虛擬客服:
|
653 |
+
* 這是一個實驗性質的AI 客服
|
654 |
+
* 講話超過15秒就不會產生,正在要求放寬限制
|
655 |
+
* 想要放誰的頭像都可以, 要放董事長也可以.
|
656 |
+
* 訂閱��(有效時間 6/13~7/13)
|
657 |
+
""")
|
658 |
+
with gr.Row():
|
659 |
+
chatbot = gr.Chatbot(value=[], elem_id="chatbot").style(height=400)
|
660 |
+
with gr.Row():
|
661 |
+
with gr.Column(scale=5):
|
662 |
+
msg = gr.Textbox(
|
663 |
+
show_label=False,
|
664 |
+
placeholder="輸入你的問題",
|
665 |
+
)
|
666 |
+
with gr.Column(scale=1):
|
667 |
+
clear = gr.Button("清除")
|
668 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot, video_html, audio_html], queue=True)
|
669 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
670 |
+
#3rd youtube
|
671 |
+
with gr.Tab("Youtube 影片摘要"):
|
672 |
+
with gr.Row():
|
673 |
+
with gr.Column(scale=1):
|
674 |
+
youtube_gr = gr.HTML(generate_iframe_for_youtube("https://www.youtube.com/embed/"))
|
675 |
+
youtube_link=gr.Textbox(interactive=True, label="在此貼上Youtube link:", placeholder="e.g. https://www.youtube.com/watch?v=xxxxxxxxx")
|
676 |
+
youtube_link.change(generate_iframe_for_youtube,youtube_link,youtube_gr)
|
677 |
+
youtube_analysis_btn=gr.Button("送出解析")
|
678 |
+
with gr.Column(scale=1):
|
679 |
+
youtube_summary_textbox=gr.Textbox(interactive=False, label="AI 解析", lines=20)
|
680 |
+
youtube_analysis_btn.click(youtube_summary,youtube_link,youtube_summary_textbox)
|
681 |
+
with gr.Tab("高雄市政府票証"):
|
682 |
+
from langchain.agents import create_pandas_dataframe_agent
|
683 |
+
import pandas as pd
|
684 |
+
mypath = root_file_path+ks_source_path
|
685 |
+
onlyfiles = os.listdir(mypath)
|
686 |
+
df = pd.concat((pd.read_csv(os.path.join(mypath, filename)) for filename in onlyfiles))
|
687 |
+
with gr.Row():
|
688 |
+
gr.Markdown("""
|
689 |
+
### 使用方式
|
690 |
+
這是一個使用高雄公車票證資料, 運用AI協助決策的工具.
|
691 |
+
如果有出現error, 請重新刷新頁面. 有error 就代表運算到最後token 數量超出azure openai 上限了, 這部份還在想辦法調整中.
|
692 |
+
""")
|
693 |
+
invField = gr.Textbox(visible=False)
|
694 |
+
gr.Examples(onlyfiles, label="資料庫檔案", inputs=invField, examples_per_page=4)
|
695 |
+
with gr.Row():
|
696 |
+
with gr.Column():
|
697 |
+
davinci="text-davinci-003"
|
698 |
+
llm = AzureOpenAI(
|
699 |
+
deployment_name=davinci,
|
700 |
+
model_name=davinci,
|
701 |
+
max_tokens=2000,
|
702 |
+
temperature=0,
|
703 |
+
)
|
704 |
+
|
705 |
+
agent=create_pandas_dataframe_agent(
|
706 |
+
llm,
|
707 |
+
df,
|
708 |
+
max_iterations=30,
|
709 |
+
return_intermediate_steps=False,
|
710 |
+
verbose=True
|
711 |
+
)
|
712 |
+
|
713 |
+
def tmp_respond(prompt_str,message, chat_history):
|
714 |
+
try:
|
715 |
+
new_str=prompt_str.format(message=message, chat_history=chat_history)
|
716 |
+
answer=agent.run(new_str)
|
717 |
+
chat_history.append((message, answer))
|
718 |
+
except Exception as e:
|
719 |
+
response = str(e)
|
720 |
+
print(f"Got error!{response}")
|
721 |
+
if not response.startswith("Could not parse LLM output: `"):
|
722 |
+
raise e
|
723 |
+
answer = response.removeprefix("Could not parse LLM output: `").removesuffix("`")
|
724 |
+
chat_history.append((message, answer))
|
725 |
+
return '', chat_history
|
726 |
+
|
727 |
+
tmp_chatbot = gr.Chatbot(value=[], elem_id="tmp_chatbot").style(height=500)
|
728 |
+
with gr.Row():
|
729 |
+
with gr.Column(scale=5):
|
730 |
+
tmp_msg = gr.Textbox(
|
731 |
+
show_label=False,
|
732 |
+
placeholder="輸入你的問題",
|
733 |
+
)
|
734 |
+
with gr.Column(scale=1):
|
735 |
+
tmp_clear = gr.Button("清除對話")
|
736 |
+
with gr.Column():
|
737 |
+
prompt_textbox=gr.Textbox("""
|
738 |
+
你是一位專業的資料科學家,有下列定義:
|
739 |
+
1.每個票卡序號代表一名乘客
|
740 |
+
2.原始票價視為花費或是消費
|
741 |
+
3.轉乘次數: 一名乘客在同一天有任意兩筆紀錄,其中一筆出下車站的資料等於另一筆進上車站的資料,其出下車站代表的車站的轉乘次數就要增加1.
|
742 |
+
歷史訊息是 {chat_history}
|
743 |
+
請以中文回答我下面的問題:{message}
|
744 |
+
""", lines=10, label="Prompt:有{chat_history}及{message}, 請至少保留{message}變數", interactive=True, max_lines=10)
|
745 |
+
console=gr.Textbox(lines=11, label="Console",max_lines=11)
|
746 |
+
tmp_msg.submit(tmp_respond, [prompt_textbox, tmp_msg, tmp_chatbot], [tmp_msg, tmp_chatbot], queue=True)
|
747 |
+
tmp_clear.click(lambda: None, None, tmp_chatbot, queue=False)
|
748 |
+
with gr.Row():
|
749 |
+
gr.Examples([
|
750 |
+
'你有哪些業者?',
|
751 |
+
'0001站轉乘旅客所佔比例',
|
752 |
+
'高雄捷運的2022年7月份運輸量與2022年6月份相比, 增減如何?',
|
753 |
+
'請給我2022年6月至2022年7月之間, 轉乘數量最高排名前五名的車站?',
|
754 |
+
'0001站 在2022年9月份轉乘數量是未知. 請依2022年7月份到2022年8月份的趨勢, 請以月份做為時間單位, 做出一個數學模型. 用此數學模型來預測 0001站 在2022年9月份的轉乘數量會多少, 增減如何?'
|
755 |
+
], label="訊息範例",inputs=tmp_msg)
|
756 |
+
demo.queue(concurrency_count=10)
|
757 |
+
lunch_style(demo,console)
|
758 |
+
|
759 |
+
def test():
|
760 |
+
mypath = "C:\\Users\\catsk\\SourceCode\\azure_openai_poc\\data\\ks_source_files"
|
761 |
+
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
|
762 |
+
print(onlyfiles)
|
763 |
+
gradio_run()
|
764 |
+
|
765 |
+
|
azure_utils.py
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This class stores Azure voice data. Specifically, the class stores several records containing
|
2 |
+
# language, lang_code, gender, voice_id and engine. The class also has a method to return the
|
3 |
+
# voice_id, lang_code and engine given a language and gender.
|
4 |
+
|
5 |
+
NEURAL_ENGINE = "neural"
|
6 |
+
STANDARD_ENGINE = "standard"
|
7 |
+
|
8 |
+
|
9 |
+
class AzureVoiceData:
|
10 |
+
def get_voice(self, language, gender):
|
11 |
+
for voice in self.voice_data:
|
12 |
+
if voice['language'] == language and voice['gender'] == gender:
|
13 |
+
return voice['azure_voice']
|
14 |
+
return None
|
15 |
+
|
16 |
+
def __init__(self):
|
17 |
+
self.voice_data = [
|
18 |
+
{'language': 'Arabic',
|
19 |
+
'azure_voice': 'ar-EG-ShakirNeural',
|
20 |
+
'gender': 'Male'},
|
21 |
+
{'language': 'Arabic (Gulf)',
|
22 |
+
'azure_voice': 'ar-KW-FahedNeural',
|
23 |
+
'gender': 'Male'},
|
24 |
+
{'language': 'Catalan',
|
25 |
+
'azure_voice': 'ca-ES-EnricNeural',
|
26 |
+
'gender': 'Male'},
|
27 |
+
{'language': 'Chinese (Cantonese)',
|
28 |
+
'azure_voice': 'yue-CN-YunSongNeural',
|
29 |
+
'gender': 'Male'},
|
30 |
+
{'language': 'Chinese (Mandarin)',
|
31 |
+
'azure_voice': 'zh-CN-YunxiNeural',
|
32 |
+
'gender': 'Male'},
|
33 |
+
{'language': 'Danish',
|
34 |
+
'azure_voice': 'da-DK-JeppeNeural',
|
35 |
+
'gender': 'Male'},
|
36 |
+
{'language': 'Dutch',
|
37 |
+
'azure_voice': 'nl-NL-MaartenNeural',
|
38 |
+
'gender': 'Male'},
|
39 |
+
{'language': 'English (Australian)',
|
40 |
+
'azure_voice': 'en-AU-KenNeural',
|
41 |
+
'gender': 'Male'},
|
42 |
+
{'language': 'English (British)',
|
43 |
+
'azure_voice': 'en-GB-RyanNeural',
|
44 |
+
'gender': 'Male'},
|
45 |
+
{'language': 'English (Indian)',
|
46 |
+
'azure_voice': 'en-IN-PrabhatNeural',
|
47 |
+
'gender': 'Male'},
|
48 |
+
{'language': 'English (New Zealand)',
|
49 |
+
'azure_voice': 'en-NZ-MitchellNeural',
|
50 |
+
'gender': 'Male'},
|
51 |
+
{'language': 'English (South African)',
|
52 |
+
'azure_voice': 'en-ZA-LukeNeural',
|
53 |
+
'gender': 'Male'},
|
54 |
+
{'language': 'English (US)',
|
55 |
+
'azure_voice': 'en-US-ChristopherNeural',
|
56 |
+
'gender': 'Male'},
|
57 |
+
{'language': 'English (Welsh)',
|
58 |
+
'azure_voice': 'cy-GB-AledNeural',
|
59 |
+
'gender': 'Male'},
|
60 |
+
{'language': 'Finnish',
|
61 |
+
'azure_voice': 'fi-FI-HarriNeural',
|
62 |
+
'gender': 'Male'},
|
63 |
+
{'language': 'French',
|
64 |
+
'azure_voice': 'fr-FR-HenriNeural',
|
65 |
+
'gender': 'Male'},
|
66 |
+
{'language': 'French (Canadian)',
|
67 |
+
'azure_voice': 'fr-CA-AntoineNeural',
|
68 |
+
'gender': 'Male'},
|
69 |
+
{'language': 'German',
|
70 |
+
'azure_voice': 'de-DE-KlausNeural',
|
71 |
+
'gender': 'Male'},
|
72 |
+
{'language': 'German (Austrian)',
|
73 |
+
'azure_voice': 'de-AT-JonasNeural',
|
74 |
+
'gender': 'Male'},
|
75 |
+
{'language': 'Hindi',
|
76 |
+
'azure_voice': 'hi-IN-MadhurNeural',
|
77 |
+
'gender': 'Male'},
|
78 |
+
{'language': 'Icelandic',
|
79 |
+
'azure_voice': 'is-IS-GunnarNeural',
|
80 |
+
'gender': 'Male'},
|
81 |
+
{'language': 'Italian',
|
82 |
+
'azure_voice': 'it-IT-GianniNeural',
|
83 |
+
'gender': 'Male'},
|
84 |
+
{'language': 'Japanese',
|
85 |
+
'azure_voice': 'ja-JP-KeitaNeural',
|
86 |
+
'gender': 'Male'},
|
87 |
+
{'language': 'Korean',
|
88 |
+
'azure_voice': 'ko-KR-GookMinNeural',
|
89 |
+
'gender': 'Male'},
|
90 |
+
{'language': 'Norwegian',
|
91 |
+
'azure_voice': 'nb-NO-FinnNeural',
|
92 |
+
'gender': 'Male'},
|
93 |
+
{'language': 'Polish',
|
94 |
+
'azure_voice': 'pl-PL-MarekNeural',
|
95 |
+
'gender': 'Male'},
|
96 |
+
{'language': 'Portuguese (Brazilian)',
|
97 |
+
'azure_voice': 'pt-BR-NicolauNeural',
|
98 |
+
'gender': 'Male'},
|
99 |
+
{'language': 'Portuguese (European)',
|
100 |
+
'azure_voice': 'pt-PT-DuarteNeural',
|
101 |
+
'gender': 'Male'},
|
102 |
+
{'language': 'Romanian',
|
103 |
+
'azure_voice': 'ro-RO-EmilNeural',
|
104 |
+
'gender': 'Male'},
|
105 |
+
{'language': 'Russian',
|
106 |
+
'azure_voice': 'ru-RU-DmitryNeural',
|
107 |
+
'gender': 'Male'},
|
108 |
+
{'language': 'Spanish (European)',
|
109 |
+
'azure_voice': 'es-ES-TeoNeural',
|
110 |
+
'gender': 'Male'},
|
111 |
+
{'language': 'Spanish (Mexican)',
|
112 |
+
'azure_voice': 'es-MX-LibertoNeural',
|
113 |
+
'gender': 'Male'},
|
114 |
+
{'language': 'Spanish (US)',
|
115 |
+
'azure_voice': 'es-US-AlonsoNeural"',
|
116 |
+
'gender': 'Male'},
|
117 |
+
{'language': 'Swedish',
|
118 |
+
'azure_voice': 'sv-SE-MattiasNeural',
|
119 |
+
'gender': 'Male'},
|
120 |
+
{'language': 'Turkish',
|
121 |
+
'azure_voice': 'tr-TR-AhmetNeural',
|
122 |
+
'gender': 'Male'},
|
123 |
+
{'language': 'Welsh',
|
124 |
+
'azure_voice': 'cy-GB-AledNeural',
|
125 |
+
'gender': 'Male'},
|
126 |
+
]
|
127 |
+
|
128 |
+
|
129 |
+
# Run from the command-line
|
130 |
+
if __name__ == '__main__':
|
131 |
+
azure_voice_data = AzureVoiceData()
|
132 |
+
|
133 |
+
azure_voice = azure_voice_data.get_voice('English (US)', 'Male')
|
134 |
+
print('English (US)', 'Male', azure_voice)
|
135 |
+
|
136 |
+
azure_voice = azure_voice_data.get_voice('English (US)', 'Female')
|
137 |
+
print('English (US)', 'Female', azure_voice)
|
138 |
+
|
139 |
+
azure_voice = azure_voice_data.get_voice('French', 'Female')
|
140 |
+
print('French', 'Female', azure_voice)
|
141 |
+
|
142 |
+
azure_voice = azure_voice_data.get_voice('French', 'Male')
|
143 |
+
print('French', 'Male', azure_voice)
|
144 |
+
|
145 |
+
azure_voice = azure_voice_data.get_voice('Japanese', 'Female')
|
146 |
+
print('Japanese', 'Female', azure_voice)
|
147 |
+
|
148 |
+
azure_voice = azure_voice_data.get_voice('Japanese', 'Male')
|
149 |
+
print('Japanese', 'Male', azure_voice)
|
150 |
+
|
151 |
+
azure_voice = azure_voice_data.get_voice('Hindi', 'Female')
|
152 |
+
print('Hindi', 'Female', azure_voice)
|
153 |
+
|
154 |
+
azure_voice = azure_voice_data.get_voice('Hindi', 'Male')
|
155 |
+
print('Hindi', 'Male', azure_voice)
|
cache.sqlite3
ADDED
Binary file (12.3 kB). View file
|
|
data/audios/tempfile.mp3
ADDED
Binary file (18.9 kB). View file
|
|
data/ks_source/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
*.csv filter=lfs diff=lfs merge=lfs -text
|
data/ks_source/110年07月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9ad310e9f1f660b48e44aa32150d3223f6706476cec0307aa7dd7d687ab945e9
|
3 |
+
size 18657193
|
data/ks_source/110年08月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0dbc4041053d8ce0c36c90beaa75926c7e5cbe840db484898a44585c738fa10d
|
3 |
+
size 33381982
|
data/ks_source/110年09月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:115c785bbba83a5c57ce32c0947489b26008900ff7782a9b0506011e79b35971
|
3 |
+
size 85816562
|
data/ks_source/110年10月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6bed4234dd0e4ad1d568ed3036b3a26fa6186ccaeca3eb88bfa47d1d09d3d2f1
|
3 |
+
size 108897445
|
data/ks_source/110年11月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a6512839dbcee4308536315888a2007b96974d5a69fea59fd24bbd5318b0410c
|
3 |
+
size 118424302
|
data/ks_source/110年12月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4245d9f05f2fa10993a1a715e5457102236023116f454009c50486465142a1a3
|
3 |
+
size 119017044
|
data/ks_source/111年01月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:57acd362db6c7b86e8be0a18608a055215bc8cab83453263b529aaa8d82a96cc
|
3 |
+
size 83616693
|
data/ks_source/111年02月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:932b5f84a88db8d3241762af24fd798782703c40e623414f6cade97bb3dfacc9
|
3 |
+
size 64076063
|
data/ks_source/111年03月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cbf0fe2933fff2af651ced11aa7d8a730534c596c86c3277211874ccd5807892
|
3 |
+
size 116143953
|
data/ks_source/111年04月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cc59a8c8b91a0b64ee722f8356a5ff0e4e222205c1675a7d650dadbf4da5abd0
|
3 |
+
size 96744856
|
data/ks_source/111年05月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e24f683e54b094e766365b4b07c4b0d6271393cde8f7b007fbf1a22a3526947
|
3 |
+
size 74946870
|
data/ks_source/111年06月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ceeefd6c9709b7eae07e14861f98d9891037127226fd890dfb1ec17abb4496b4
|
3 |
+
size 46411695
|
data/ks_source/111年07月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:14723aaf372a8571ab146af1ca470cfa86e69f95dda07a694edb28941f80a004
|
3 |
+
size 84705392
|
data/ks_source/111年08月MaaS交易資料-(例行).csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:22f76a80c0e89354316ce8a9d461eef243b93f6dae4baa466fbd0679ff8cf94f
|
3 |
+
size 94058824
|
data/vector.png
ADDED
![]() |
data/videos/Masahiro.mp4
ADDED
Binary file (228 kB). View file
|
|
data/videos/Masahiro1.mp4
ADDED
Binary file (228 kB). View file
|
|
data/videos/tempfile.mp4
ADDED
Binary file (88.3 kB). View file
|
|
poc_langchain.spec
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- mode: python ; coding: utf-8 -*-
|
2 |
+
|
3 |
+
|
4 |
+
block_cipher = None
|
5 |
+
|
6 |
+
|
7 |
+
a = Analysis(
|
8 |
+
['poc_langchain.py'],
|
9 |
+
pathex=[],
|
10 |
+
binaries=[],
|
11 |
+
datas=[],
|
12 |
+
hiddenimports=[],
|
13 |
+
hookspath=[],
|
14 |
+
hooksconfig={},
|
15 |
+
runtime_hooks=[],
|
16 |
+
excludes=[],
|
17 |
+
win_no_prefer_redirects=False,
|
18 |
+
win_private_assemblies=False,
|
19 |
+
cipher=block_cipher,
|
20 |
+
noarchive=False,
|
21 |
+
)
|
22 |
+
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
23 |
+
|
24 |
+
exe = EXE(
|
25 |
+
pyz,
|
26 |
+
a.scripts,
|
27 |
+
[],
|
28 |
+
exclude_binaries=True,
|
29 |
+
name='poc_langchain',
|
30 |
+
debug=False,
|
31 |
+
bootloader_ignore_signals=False,
|
32 |
+
strip=False,
|
33 |
+
upx=True,
|
34 |
+
console=True,
|
35 |
+
disable_windowed_traceback=False,
|
36 |
+
argv_emulation=False,
|
37 |
+
target_arch=None,
|
38 |
+
codesign_identity=None,
|
39 |
+
entitlements_file=None,
|
40 |
+
)
|
41 |
+
coll = COLLECT(
|
42 |
+
exe,
|
43 |
+
a.binaries,
|
44 |
+
a.zipfiles,
|
45 |
+
a.datas,
|
46 |
+
strip=False,
|
47 |
+
upx=True,
|
48 |
+
upx_exclude=[],
|
49 |
+
name='poc_langchain',
|
50 |
+
)
|
polly_utils.py
ADDED
@@ -0,0 +1,635 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This class stores Polly voice data. Specifically, the class stores several records containing
|
2 |
+
# language, lang_code, gender, voice_id and engine. The class also has a method to return the
|
3 |
+
# voice_id, lang_code and engine given a language and gender.
|
4 |
+
|
5 |
+
NEURAL_ENGINE = "neural"
|
6 |
+
STANDARD_ENGINE = "standard"
|
7 |
+
|
8 |
+
|
9 |
+
class PollyVoiceData:
|
10 |
+
def get_voice(self, language, gender):
|
11 |
+
for voice in self.voice_data:
|
12 |
+
if voice['language'] == language and voice['gender'] == gender:
|
13 |
+
if voice['neural'] == 'Yes':
|
14 |
+
return voice['voice_id'], voice['lang_code'], NEURAL_ENGINE
|
15 |
+
for voice in self.voice_data:
|
16 |
+
if voice['language'] == language and voice['gender'] == gender:
|
17 |
+
if voice['standard'] == 'Yes':
|
18 |
+
return voice['voice_id'], voice['lang_code'], STANDARD_ENGINE
|
19 |
+
return None, None, None
|
20 |
+
|
21 |
+
def get_whisper_lang_code(self, language):
|
22 |
+
for voice in self.voice_data:
|
23 |
+
if voice['language'] == language:
|
24 |
+
return voice['whisper_lang_code']
|
25 |
+
return "en"
|
26 |
+
|
27 |
+
def __init__(self):
|
28 |
+
self.voice_data = [
|
29 |
+
{'language': 'Arabic',
|
30 |
+
'lang_code': 'arb',
|
31 |
+
'whisper_lang_code': 'ar',
|
32 |
+
'voice_id': 'Zeina',
|
33 |
+
'gender': 'Female',
|
34 |
+
'neural': 'No',
|
35 |
+
'standard': 'Yes'},
|
36 |
+
{'language': 'Arabic (Gulf)',
|
37 |
+
'lang_code': 'ar-AE',
|
38 |
+
'whisper_lang_code': 'ar',
|
39 |
+
'voice_id': 'Hala',
|
40 |
+
'gender': 'Female',
|
41 |
+
'neural': 'Yes',
|
42 |
+
'standard': 'No'},
|
43 |
+
{'language': 'Catalan',
|
44 |
+
'lang_code': 'ca-ES',
|
45 |
+
'whisper_lang_code': 'ca',
|
46 |
+
'voice_id': 'Arlet',
|
47 |
+
'gender': 'Female',
|
48 |
+
'neural': 'Yes',
|
49 |
+
'standard': 'No'},
|
50 |
+
{'language': 'Chinese (Cantonese)',
|
51 |
+
'lang_code': 'yue-CN',
|
52 |
+
'whisper_lang_code': 'zh',
|
53 |
+
'voice_id': 'Hiujin',
|
54 |
+
'gender': 'Female',
|
55 |
+
'neural': 'Yes',
|
56 |
+
'standard': 'No'},
|
57 |
+
{'language': 'Chinese (Mandarin)',
|
58 |
+
'lang_code': 'cmn-CN',
|
59 |
+
'whisper_lang_code': 'zh',
|
60 |
+
'voice_id': 'Zhiyu',
|
61 |
+
'gender': 'Female',
|
62 |
+
'neural': 'Yes',
|
63 |
+
'standard': 'No'},
|
64 |
+
{'language': 'Danish',
|
65 |
+
'lang_code': 'da-DK',
|
66 |
+
'whisper_lang_code': 'da',
|
67 |
+
'voice_id': 'Naja',
|
68 |
+
'gender': 'Female',
|
69 |
+
'neural': 'No',
|
70 |
+
'standard': 'Yes'},
|
71 |
+
{'language': 'Danish',
|
72 |
+
'lang_code': 'da-DK',
|
73 |
+
'whisper_lang_code': 'da',
|
74 |
+
'voice_id': 'Mads',
|
75 |
+
'gender': 'Male',
|
76 |
+
'neural': 'No',
|
77 |
+
'standard': 'Yes'},
|
78 |
+
{'language': 'Dutch',
|
79 |
+
'lang_code': 'nl-NL',
|
80 |
+
'whisper_lang_code': 'nl',
|
81 |
+
'voice_id': 'Laura',
|
82 |
+
'gender': 'Female',
|
83 |
+
'neural': 'Yes',
|
84 |
+
'standard': 'No'},
|
85 |
+
{'language': 'Dutch',
|
86 |
+
'lang_code': 'nl-NL',
|
87 |
+
'whisper_lang_code': 'nl',
|
88 |
+
'voice_id': 'Lotte',
|
89 |
+
'gender': 'Female',
|
90 |
+
'neural': 'No',
|
91 |
+
'standard': 'Yes'},
|
92 |
+
{'language': 'Dutch',
|
93 |
+
'lang_code': 'nl-NL',
|
94 |
+
'whisper_lang_code': 'nl',
|
95 |
+
'voice_id': 'Ruben',
|
96 |
+
'gender': 'Male',
|
97 |
+
'neural': 'No',
|
98 |
+
'standard': 'Yes'},
|
99 |
+
{'language': 'English (Australian)',
|
100 |
+
'lang_code': 'en-AU',
|
101 |
+
'whisper_lang_code': 'en',
|
102 |
+
'voice_id': 'Nicole',
|
103 |
+
'gender': 'Female',
|
104 |
+
'neural': 'No',
|
105 |
+
'standard': 'Yes'},
|
106 |
+
{'language': 'English (Australian)',
|
107 |
+
'lang_code': 'en-AU',
|
108 |
+
'whisper_lang_code': 'en',
|
109 |
+
'voice_id': 'Olivia',
|
110 |
+
'gender': 'Female',
|
111 |
+
'neural': 'Yes',
|
112 |
+
'standard': 'No'},
|
113 |
+
{'language': 'English (Australian)',
|
114 |
+
'lang_code': 'en-AU',
|
115 |
+
'whisper_lang_code': 'en',
|
116 |
+
'voice_id': 'Russell',
|
117 |
+
'gender': 'Male',
|
118 |
+
'neural': 'No',
|
119 |
+
'standard': 'Yes'},
|
120 |
+
{'language': 'English (British)',
|
121 |
+
'lang_code': 'en-GB',
|
122 |
+
'whisper_lang_code': 'en',
|
123 |
+
'voice_id': 'Amy',
|
124 |
+
'gender': 'Female',
|
125 |
+
'neural': 'Yes',
|
126 |
+
'standard': 'Yes'},
|
127 |
+
{'language': 'English (British)',
|
128 |
+
'lang_code': 'en-GB',
|
129 |
+
'whisper_lang_code': 'en',
|
130 |
+
'voice_id': 'Emma',
|
131 |
+
'gender': 'Female',
|
132 |
+
'neural': 'Yes',
|
133 |
+
'standard': 'Yes'},
|
134 |
+
{'language': 'English (British)',
|
135 |
+
'lang_code': 'en-GB',
|
136 |
+
'whisper_lang_code': 'en',
|
137 |
+
'voice_id': 'Brian',
|
138 |
+
'gender': 'Male',
|
139 |
+
'neural': 'Yes',
|
140 |
+
'standard': 'Yes'},
|
141 |
+
{'language': 'English (British)',
|
142 |
+
'lang_code': 'en-GB',
|
143 |
+
'whisper_lang_code': 'en',
|
144 |
+
'voice_id': 'Arthur',
|
145 |
+
'gender': 'Male',
|
146 |
+
'neural': 'Yes',
|
147 |
+
'standard': 'No'},
|
148 |
+
{'language': 'English (Indian)',
|
149 |
+
'lang_code': 'en-IN',
|
150 |
+
'whisper_lang_code': 'en',
|
151 |
+
'voice_id': 'Aditi',
|
152 |
+
'gender': 'Female',
|
153 |
+
'neural': 'No',
|
154 |
+
'standard': 'Yes'},
|
155 |
+
{'language': 'English (Indian)',
|
156 |
+
'lang_code': 'en-IN',
|
157 |
+
'whisper_lang_code': 'en',
|
158 |
+
'voice_id': 'Raveena',
|
159 |
+
'gender': 'Female',
|
160 |
+
'neural': 'No',
|
161 |
+
'standard': 'Yes'},
|
162 |
+
{'language': 'English (Indian)',
|
163 |
+
'lang_code': 'en-IN',
|
164 |
+
'whisper_lang_code': 'en',
|
165 |
+
'voice_id': 'Kajal',
|
166 |
+
'gender': 'Female',
|
167 |
+
'neural': 'Yes',
|
168 |
+
'standard': 'No'},
|
169 |
+
{'language': 'English (New Zealand)',
|
170 |
+
'lang_code': 'en-NZ',
|
171 |
+
'whisper_lang_code': 'en',
|
172 |
+
'voice_id': 'Aria',
|
173 |
+
'gender': 'Female',
|
174 |
+
'neural': 'Yes',
|
175 |
+
'standard': 'No'},
|
176 |
+
{'language': 'English (South African)',
|
177 |
+
'lang_code': 'en-ZA',
|
178 |
+
'whisper_lang_code': 'en',
|
179 |
+
'voice_id': 'Ayanda',
|
180 |
+
'gender': 'Female',
|
181 |
+
'neural': 'Yes',
|
182 |
+
'standard': 'No'},
|
183 |
+
{'language': 'English (US)',
|
184 |
+
'lang_code': 'en-US',
|
185 |
+
'whisper_lang_code': 'en',
|
186 |
+
'voice_id': 'Ivy',
|
187 |
+
'gender': 'Female (child)',
|
188 |
+
'neural': 'Yes',
|
189 |
+
'standard': 'Yes'},
|
190 |
+
{'language': 'English (US)',
|
191 |
+
'lang_code': 'en-US',
|
192 |
+
'whisper_lang_code': 'en',
|
193 |
+
'voice_id': 'Joanna',
|
194 |
+
'gender': 'Female',
|
195 |
+
'neural': 'Yes',
|
196 |
+
'standard': 'Yes'},
|
197 |
+
{'language': 'English (US)',
|
198 |
+
'lang_code': 'en-US',
|
199 |
+
'whisper_lang_code': 'en',
|
200 |
+
'voice_id': 'Kendra',
|
201 |
+
'gender': 'Female',
|
202 |
+
'neural': 'Yes',
|
203 |
+
'standard': 'Yes'},
|
204 |
+
{'language': 'English (US)',
|
205 |
+
'lang_code': 'en-US',
|
206 |
+
'whisper_lang_code': 'en',
|
207 |
+
'voice_id': 'Kimberly',
|
208 |
+
'gender': 'Female',
|
209 |
+
'neural': 'Yes',
|
210 |
+
'standard': 'Yes'},
|
211 |
+
{'language': 'English (US)',
|
212 |
+
'lang_code': 'en-US',
|
213 |
+
'whisper_lang_code': 'en',
|
214 |
+
'voice_id': 'Salli',
|
215 |
+
'gender': 'Female',
|
216 |
+
'neural': 'Yes',
|
217 |
+
'standard': 'Yes'},
|
218 |
+
{'language': 'English (US)',
|
219 |
+
'lang_code': 'en-US',
|
220 |
+
'whisper_lang_code': 'en',
|
221 |
+
'voice_id': 'Joey',
|
222 |
+
'gender': 'Male',
|
223 |
+
'neural': 'Yes',
|
224 |
+
'standard': 'Yes'},
|
225 |
+
{'language': 'English (US)',
|
226 |
+
'lang_code': 'en-US',
|
227 |
+
'whisper_lang_code': 'en',
|
228 |
+
'voice_id': 'Justin',
|
229 |
+
'gender': 'Male (child)',
|
230 |
+
'neural': 'Yes',
|
231 |
+
'standard': 'Yes'},
|
232 |
+
{'language': 'English (US)',
|
233 |
+
'lang_code': 'en-US',
|
234 |
+
'whisper_lang_code': 'en',
|
235 |
+
'voice_id': 'Kevin',
|
236 |
+
'gender': 'Male (child)',
|
237 |
+
'neural': 'Yes',
|
238 |
+
'standard': 'No'},
|
239 |
+
{'language': 'English (US)',
|
240 |
+
'lang_code': 'en-US',
|
241 |
+
'whisper_lang_code': 'en',
|
242 |
+
'voice_id': 'Matthew',
|
243 |
+
'gender': 'Male',
|
244 |
+
'neural': 'Yes',
|
245 |
+
'standard': 'Yes'},
|
246 |
+
{'language': 'English (Welsh)',
|
247 |
+
'lang_code': 'en-GB-WLS',
|
248 |
+
'whisper_lang_code': 'en',
|
249 |
+
'voice_id': 'Geraint',
|
250 |
+
'gender': 'Male',
|
251 |
+
'neural': 'No',
|
252 |
+
'standard': 'Yes'},
|
253 |
+
{'language': 'Finnish',
|
254 |
+
'lang_code': 'fi-FI',
|
255 |
+
'whisper_lang_code': 'fi',
|
256 |
+
'voice_id': 'Suvi',
|
257 |
+
'gender': 'Female',
|
258 |
+
'neural': 'Yes',
|
259 |
+
'standard': 'No'},
|
260 |
+
{'language': 'French',
|
261 |
+
'lang_code': 'fr-FR',
|
262 |
+
'whisper_lang_code': 'fr',
|
263 |
+
'voice_id': 'Celine',
|
264 |
+
'gender': 'Female',
|
265 |
+
'neural': 'No',
|
266 |
+
'standard': 'Yes'},
|
267 |
+
{'language': 'French',
|
268 |
+
'lang_code': 'fr-FR',
|
269 |
+
'whisper_lang_code': 'fr',
|
270 |
+
'voice_id': 'Lea',
|
271 |
+
'gender': 'Female',
|
272 |
+
'neural': 'Yes',
|
273 |
+
'standard': 'Yes'},
|
274 |
+
{'language': 'French',
|
275 |
+
'lang_code': 'fr-FR',
|
276 |
+
'whisper_lang_code': 'fr',
|
277 |
+
'voice_id': 'Mathieu',
|
278 |
+
'gender': 'Male',
|
279 |
+
'neural': 'No',
|
280 |
+
'standard': 'Yes'},
|
281 |
+
{'language': 'French (Canadian)',
|
282 |
+
'lang_code': 'fr-CA',
|
283 |
+
'whisper_lang_code': 'fr',
|
284 |
+
'voice_id': 'Chantal',
|
285 |
+
'gender': 'Female',
|
286 |
+
'neural': 'No',
|
287 |
+
'standard': 'Yes'},
|
288 |
+
{'language': 'French (Canadian)',
|
289 |
+
'lang_code': 'fr-CA',
|
290 |
+
'whisper_lang_code': 'fr',
|
291 |
+
'voice_id': 'Gabrielle',
|
292 |
+
'gender': 'Female',
|
293 |
+
'neural': 'Yes',
|
294 |
+
'standard': 'No'},
|
295 |
+
{'language': 'French (Canadian)',
|
296 |
+
'lang_code': 'fr-CA',
|
297 |
+
'whisper_lang_code': 'fr',
|
298 |
+
'voice_id': 'Liam',
|
299 |
+
'gender': 'Male',
|
300 |
+
'neural': 'Yes',
|
301 |
+
'standard': 'No'},
|
302 |
+
{'language': 'German',
|
303 |
+
'lang_code': 'de-DE',
|
304 |
+
'whisper_lang_code': 'de',
|
305 |
+
'voice_id': 'Marlene',
|
306 |
+
'gender': 'Female',
|
307 |
+
'neural': 'No',
|
308 |
+
'standard': 'Yes'},
|
309 |
+
{'language': 'German',
|
310 |
+
'lang_code': 'de-DE',
|
311 |
+
'whisper_lang_code': 'de',
|
312 |
+
'voice_id': 'Vicki',
|
313 |
+
'gender': 'Female',
|
314 |
+
'neural': 'Yes',
|
315 |
+
'standard': 'Yes'},
|
316 |
+
{'language': 'German',
|
317 |
+
'lang_code': 'de-DE',
|
318 |
+
'whisper_lang_code': 'de',
|
319 |
+
'voice_id': 'Hans',
|
320 |
+
'gender': 'Male',
|
321 |
+
'neural': 'No',
|
322 |
+
'standard': 'Yes'},
|
323 |
+
{'language': 'German',
|
324 |
+
'lang_code': 'de-DE',
|
325 |
+
'whisper_lang_code': 'de',
|
326 |
+
'voice_id': 'Daniel',
|
327 |
+
'gender': 'Male',
|
328 |
+
'neural': 'Yes',
|
329 |
+
'standard': 'No'},
|
330 |
+
{'language': 'German (Austrian)',
|
331 |
+
'lang_code': 'de-AT',
|
332 |
+
'whisper_lang_code': 'de',
|
333 |
+
'voice_id': 'Hannah',
|
334 |
+
'gender': 'Female',
|
335 |
+
'neural': 'Yes',
|
336 |
+
'standard': 'No'},
|
337 |
+
{'language': 'Hindi',
|
338 |
+
'lang_code': 'hi-IN',
|
339 |
+
'whisper_lang_code': 'hi',
|
340 |
+
'voice_id': 'Aditi',
|
341 |
+
'gender': 'Female',
|
342 |
+
'neural': 'No',
|
343 |
+
'standard': 'Yes'},
|
344 |
+
{'language': 'Hindi',
|
345 |
+
'lang_code': 'hi-IN',
|
346 |
+
'whisper_lang_code': 'hi',
|
347 |
+
'voice_id': 'Kajal',
|
348 |
+
'gender': 'Female',
|
349 |
+
'neural': 'Yes',
|
350 |
+
'standard': 'No'},
|
351 |
+
{'language': 'Icelandic',
|
352 |
+
'lang_code': 'is-IS',
|
353 |
+
'whisper_lang_code': 'is',
|
354 |
+
'voice_id': 'Dora',
|
355 |
+
'gender': 'Female',
|
356 |
+
'neural': 'No',
|
357 |
+
'standard': 'Yes'},
|
358 |
+
{'language': 'Icelandic',
|
359 |
+
'lang_code': 'is-IS',
|
360 |
+
'whisper_lang_code': 'is',
|
361 |
+
'voice_id': 'Karl',
|
362 |
+
'gender': 'Male',
|
363 |
+
'neural': 'No',
|
364 |
+
'standard': 'Yes'},
|
365 |
+
{'language': 'Italian',
|
366 |
+
'lang_code': 'it-IT',
|
367 |
+
'whisper_lang_code': 'it',
|
368 |
+
'voice_id': 'Carla',
|
369 |
+
'gender': 'Female',
|
370 |
+
'neural': 'No',
|
371 |
+
'standard': 'Yes'},
|
372 |
+
{'language': 'Italian',
|
373 |
+
'lang_code': 'it-IT',
|
374 |
+
'whisper_lang_code': 'it',
|
375 |
+
'voice_id': 'Bianca',
|
376 |
+
'gender': 'Female',
|
377 |
+
'neural': 'Yes',
|
378 |
+
'standard': 'Yes'},
|
379 |
+
{'language': 'Japanese',
|
380 |
+
'lang_code': 'ja-JP',
|
381 |
+
'whisper_lang_code': 'ja',
|
382 |
+
'voice_id': 'Mizuki',
|
383 |
+
'gender': 'Female',
|
384 |
+
'neural': 'No',
|
385 |
+
'standard': 'Yes'},
|
386 |
+
{'language': 'Japanese',
|
387 |
+
'lang_code': 'ja-JP',
|
388 |
+
'whisper_lang_code': 'ja',
|
389 |
+
'voice_id': 'Takumi',
|
390 |
+
'gender': 'Male',
|
391 |
+
'neural': 'Yes',
|
392 |
+
'standard': 'Yes'},
|
393 |
+
{'language': 'Korean',
|
394 |
+
'lang_code': 'ko-KR',
|
395 |
+
'whisper_lang_code': 'ko',
|
396 |
+
'voice_id': 'Seoyeon',
|
397 |
+
'gender': 'Female',
|
398 |
+
'neural': 'Yes',
|
399 |
+
'standard': 'Yes'},
|
400 |
+
{'language': 'Norwegian',
|
401 |
+
'lang_code': 'nb-NO',
|
402 |
+
'whisper_lang_code': 'no',
|
403 |
+
'voice_id': 'Liv',
|
404 |
+
'gender': 'Female',
|
405 |
+
'neural': 'No',
|
406 |
+
'standard': 'Yes'},
|
407 |
+
{'language': 'Norwegian',
|
408 |
+
'lang_code': 'nb-NO',
|
409 |
+
'whisper_lang_code': 'no',
|
410 |
+
'voice_id': 'Ida',
|
411 |
+
'gender': 'Female',
|
412 |
+
'neural': 'Yes',
|
413 |
+
'standard': 'No'},
|
414 |
+
{'language': 'Polish',
|
415 |
+
'lang_code': 'pl-PL',
|
416 |
+
'whisper_lang_code': 'pl',
|
417 |
+
'voice_id': 'Ewa',
|
418 |
+
'gender': 'Female',
|
419 |
+
'neural': 'No',
|
420 |
+
'standard': 'Yes'},
|
421 |
+
{'language': 'Polish',
|
422 |
+
'lang_code': 'pl-PL',
|
423 |
+
'whisper_lang_code': 'pl',
|
424 |
+
'voice_id': 'Maja',
|
425 |
+
'gender': 'Female',
|
426 |
+
'neural': 'No',
|
427 |
+
'standard': 'Yes'},
|
428 |
+
{'language': 'Polish',
|
429 |
+
'lang_code': 'pl-PL',
|
430 |
+
'whisper_lang_code': 'pl',
|
431 |
+
'voice_id': 'Jacek',
|
432 |
+
'gender': 'Male',
|
433 |
+
'neural': 'No',
|
434 |
+
'standard': 'Yes'},
|
435 |
+
{'language': 'Polish',
|
436 |
+
'lang_code': 'pl-PL',
|
437 |
+
'whisper_lang_code': 'pl',
|
438 |
+
'voice_id': 'Jan',
|
439 |
+
'gender': 'Male',
|
440 |
+
'neural': 'No',
|
441 |
+
'standard': 'Yes'},
|
442 |
+
{'language': 'Polish',
|
443 |
+
'lang_code': 'pl-PL',
|
444 |
+
'whisper_lang_code': 'pl',
|
445 |
+
'voice_id': 'Ola',
|
446 |
+
'gender': 'Female',
|
447 |
+
'neural': 'Yes',
|
448 |
+
'standard': 'No'},
|
449 |
+
{'language': 'Portuguese (Brazilian)',
|
450 |
+
'lang_code': 'pt-BR',
|
451 |
+
'whisper_lang_code': 'pt',
|
452 |
+
'voice_id': 'Camila',
|
453 |
+
'gender': 'Female',
|
454 |
+
'neural': 'Yes',
|
455 |
+
'standard': 'Yes'},
|
456 |
+
{'language': 'Portuguese (Brazilian)',
|
457 |
+
'lang_code': 'pt-BR',
|
458 |
+
'whisper_lang_code': 'pt',
|
459 |
+
'voice_id': 'Vitoria',
|
460 |
+
'gender': 'Female',
|
461 |
+
'neural': 'Yes',
|
462 |
+
'standard': 'Yes'},
|
463 |
+
{'language': 'Portuguese (Brazilian)',
|
464 |
+
'lang_code': 'pt-BR',
|
465 |
+
'whisper_lang_code': 'pt',
|
466 |
+
'voice_id': 'Ricardo',
|
467 |
+
'gender': 'Male',
|
468 |
+
'neural': 'No',
|
469 |
+
'standard': 'Yes'},
|
470 |
+
{'language': 'Portuguese (European)',
|
471 |
+
'lang_code': 'pt-PT',
|
472 |
+
'whisper_lang_code': 'pt',
|
473 |
+
'voice_id': 'Ines',
|
474 |
+
'gender': 'Female',
|
475 |
+
'neural': 'Yes',
|
476 |
+
'standard': 'Yes'},
|
477 |
+
{'language': 'Portuguese (European)',
|
478 |
+
'lang_code': 'pt-PT',
|
479 |
+
'whisper_lang_code': 'pt',
|
480 |
+
'voice_id': 'Cristiano',
|
481 |
+
'gender': 'Male',
|
482 |
+
'neural': 'No',
|
483 |
+
'standard': 'Yes'},
|
484 |
+
{'language': 'Romanian',
|
485 |
+
'lang_code': 'ro-RO',
|
486 |
+
'whisper_lang_code': 'ro',
|
487 |
+
'voice_id': 'Carmen',
|
488 |
+
'gender': 'Female',
|
489 |
+
'neural': 'No',
|
490 |
+
'standard': 'Yes'},
|
491 |
+
{'language': 'Russian',
|
492 |
+
'lang_code': 'ru-RU',
|
493 |
+
'whisper_lang_code': 'ru',
|
494 |
+
'voice_id': 'Tatyana',
|
495 |
+
'gender': 'Female',
|
496 |
+
'neural': 'No',
|
497 |
+
'standard': 'Yes'},
|
498 |
+
{'language': 'Russian',
|
499 |
+
'lang_code': 'ru-RU',
|
500 |
+
'whisper_lang_code': 'ru',
|
501 |
+
'voice_id': 'Maxim',
|
502 |
+
'gender': 'Male',
|
503 |
+
'neural': 'No',
|
504 |
+
'standard': 'Yes'},
|
505 |
+
{'language': 'Spanish (European)',
|
506 |
+
'lang_code': 'es-ES',
|
507 |
+
'whisper_lang_code': 'es',
|
508 |
+
'voice_id': 'Conchita',
|
509 |
+
'gender': 'Female',
|
510 |
+
'neural': 'No',
|
511 |
+
'standard': 'Yes'},
|
512 |
+
{'language': 'Spanish (European)',
|
513 |
+
'lang_code': 'es-ES',
|
514 |
+
'whisper_lang_code': 'es',
|
515 |
+
'voice_id': 'Lucia',
|
516 |
+
'gender': 'Female',
|
517 |
+
'neural': 'Yes',
|
518 |
+
'standard': 'Yes'},
|
519 |
+
{'language': 'Spanish (European)',
|
520 |
+
'lang_code': 'es-ES',
|
521 |
+
'whisper_lang_code': 'es',
|
522 |
+
'voice_id': 'Enrique',
|
523 |
+
'gender': 'Male',
|
524 |
+
'neural': 'No',
|
525 |
+
'standard': 'Yes'},
|
526 |
+
{'language': 'Spanish (Mexican)',
|
527 |
+
'lang_code': 'es-MX',
|
528 |
+
'whisper_lang_code': 'es',
|
529 |
+
'voice_id': 'Mia',
|
530 |
+
'gender': 'Female',
|
531 |
+
'neural': 'Yes',
|
532 |
+
'standard': 'Yes'},
|
533 |
+
{'language': 'Spanish (US)',
|
534 |
+
'lang_code': 'es-US',
|
535 |
+
'whisper_lang_code': 'es',
|
536 |
+
'voice_id': 'Lupe',
|
537 |
+
'gender': 'Female',
|
538 |
+
'neural': 'Yes',
|
539 |
+
'standard': 'Yes'},
|
540 |
+
{'language': 'Spanish (US)',
|
541 |
+
'lang_code': 'es-US',
|
542 |
+
'whisper_lang_code': 'es',
|
543 |
+
'voice_id': 'Penelope',
|
544 |
+
'gender': 'Female',
|
545 |
+
'neural': 'No',
|
546 |
+
'standard': 'Yes'},
|
547 |
+
{'language': 'Spanish (US)',
|
548 |
+
'lang_code': 'es-US',
|
549 |
+
'whisper_lang_code': 'es',
|
550 |
+
'voice_id': 'Miguel',
|
551 |
+
'gender': 'Male',
|
552 |
+
'neural': 'No',
|
553 |
+
'standard': 'Yes'},
|
554 |
+
{'language': 'Spanish (US)',
|
555 |
+
'lang_code': 'es-US',
|
556 |
+
'whisper_lang_code': 'es',
|
557 |
+
'voice_id': 'Pedro',
|
558 |
+
'gender': 'Male',
|
559 |
+
'neural': 'Yes',
|
560 |
+
'standard': 'No'},
|
561 |
+
{'language': 'Swedish',
|
562 |
+
'lang_code': 'sv-SE',
|
563 |
+
'whisper_lang_code': 'sv',
|
564 |
+
'voice_id': 'Astrid',
|
565 |
+
'gender': 'Female',
|
566 |
+
'neural': 'No',
|
567 |
+
'standard': 'Yes'},
|
568 |
+
{'language': 'Swedish',
|
569 |
+
'lang_code': 'sv-SE',
|
570 |
+
'whisper_lang_code': 'sv',
|
571 |
+
'voice_id': 'Elin',
|
572 |
+
'gender': 'Female',
|
573 |
+
'neural': 'Yes',
|
574 |
+
'standard': 'No'},
|
575 |
+
{'language': 'Turkish',
|
576 |
+
'lang_code': 'tr-TR',
|
577 |
+
'whisper_lang_code': 'tr',
|
578 |
+
'voice_id': 'Filiz',
|
579 |
+
'gender': 'Female',
|
580 |
+
'neural': 'No',
|
581 |
+
'standard': 'Yes'},
|
582 |
+
{'language': 'Welsh',
|
583 |
+
'lang_code': 'cy-GB',
|
584 |
+
'whisper_lang_code': 'cy',
|
585 |
+
'voice_id': 'Gwyneth',
|
586 |
+
'gender': 'Female',
|
587 |
+
'neural': 'No',
|
588 |
+
'standard': 'Yes'}
|
589 |
+
]
|
590 |
+
|
591 |
+
|
592 |
+
# Run from the command-line
|
593 |
+
if __name__ == '__main__':
|
594 |
+
polly_voice_data = PollyVoiceData()
|
595 |
+
|
596 |
+
voice_id, language_code, engine = polly_voice_data.get_voice('English (US)', 'Male')
|
597 |
+
print('English (US)', 'Male', voice_id, language_code, engine)
|
598 |
+
|
599 |
+
voice_id, language_code, engine = polly_voice_data.get_voice('English (US)', 'Female')
|
600 |
+
print('English (US)', 'Female', voice_id, language_code, engine)
|
601 |
+
|
602 |
+
voice_id, language_code, engine = polly_voice_data.get_voice('French', 'Female')
|
603 |
+
print('French', 'Female', voice_id, language_code, engine)
|
604 |
+
|
605 |
+
voice_id, language_code, engine = polly_voice_data.get_voice('French', 'Male')
|
606 |
+
print('French', 'Male', voice_id, language_code, engine)
|
607 |
+
|
608 |
+
voice_id, language_code, engine = polly_voice_data.get_voice('Japanese', 'Female')
|
609 |
+
print('Japanese', 'Female', voice_id, language_code, engine)
|
610 |
+
|
611 |
+
voice_id, language_code, engine = polly_voice_data.get_voice('Japanese', 'Male')
|
612 |
+
print('Japanese', 'Male', voice_id, language_code, engine)
|
613 |
+
|
614 |
+
voice_id, language_code, engine = polly_voice_data.get_voice('Hindi', 'Female')
|
615 |
+
print('Hindi', 'Female', voice_id, language_code, engine)
|
616 |
+
|
617 |
+
voice_id, language_code, engine = polly_voice_data.get_voice('Hindi', 'Male')
|
618 |
+
print('Hindi', 'Male', voice_id, language_code, engine)
|
619 |
+
|
620 |
+
whisper_lang_code = polly_voice_data.get_whisper_lang_code('English (US)')
|
621 |
+
print('English (US) whisper_lang_code:', whisper_lang_code)
|
622 |
+
|
623 |
+
whisper_lang_code = polly_voice_data.get_whisper_lang_code('Chinese (Mandarin)')
|
624 |
+
print('Chinese (Mandarin) whisper_lang_code:', whisper_lang_code)
|
625 |
+
|
626 |
+
whisper_lang_code = polly_voice_data.get_whisper_lang_code('Norwegian')
|
627 |
+
print('Norwegian whisper_lang_code:', whisper_lang_code)
|
628 |
+
|
629 |
+
whisper_lang_code = polly_voice_data.get_whisper_lang_code('Dutch')
|
630 |
+
print('Dutch whisper_lang_code:', whisper_lang_code)
|
631 |
+
|
632 |
+
whisper_lang_code = polly_voice_data.get_whisper_lang_code('Foo')
|
633 |
+
print('Foo whisper_lang_code:', whisper_lang_code)
|
634 |
+
|
635 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
aiofiles==23.1.0
|
2 |
+
aiohttp==3.8.4
|
3 |
+
aiosignal==1.3.1
|
4 |
+
altair==5.0.1
|
5 |
+
anyio==3.7.0
|
6 |
+
argilla==1.9.0
|
7 |
+
argon2-cffi==21.3.0
|
8 |
+
argon2-cffi-bindings==21.2.0
|
9 |
+
arrow==1.2.3
|
10 |
+
asttokens==2.2.1
|
11 |
+
async-timeout==4.0.2
|
12 |
+
attrs==23.1.0
|
13 |
+
backcall==0.2.0
|
14 |
+
backoff==2.2.1
|
15 |
+
beautifulsoup4==4.12.2
|
16 |
+
bleach==6.0.0
|
17 |
+
boto3==1.26.152
|
18 |
+
botocore==1.29.152
|
19 |
+
bs4==0.0.1
|
20 |
+
certifi==2023.5.7
|
21 |
+
cffi==1.15.1
|
22 |
+
chardet==5.1.0
|
23 |
+
charset-normalizer==3.1.0
|
24 |
+
chromadb==0.3.26
|
25 |
+
click==8.1.3
|
26 |
+
clickhouse-connect==0.6.2
|
27 |
+
colorama==0.4.6
|
28 |
+
coloredlogs==15.0.1
|
29 |
+
comm==0.1.3
|
30 |
+
commonmark==0.9.1
|
31 |
+
contourpy==1.0.7
|
32 |
+
cryptography==41.0.1
|
33 |
+
cycler==0.11.0
|
34 |
+
dataclasses-json==0.5.7
|
35 |
+
debugpy==1.6.7
|
36 |
+
decorator==5.1.1
|
37 |
+
defusedxml==0.7.1
|
38 |
+
Deprecated==1.2.14
|
39 |
+
distlib==0.3.6
|
40 |
+
duckdb==0.8.0
|
41 |
+
et-xmlfile==1.1.0
|
42 |
+
exceptiongroup==1.1.1
|
43 |
+
executing==1.2.0
|
44 |
+
fastapi==0.96.1
|
45 |
+
fastjsonschema==2.17.1
|
46 |
+
ffmpy==0.3.0
|
47 |
+
filelock==3.12.0
|
48 |
+
flatbuffers==23.5.26
|
49 |
+
fonttools==4.39.4
|
50 |
+
fqdn==1.5.1
|
51 |
+
frozenlist==1.3.3
|
52 |
+
fsspec==2023.6.0
|
53 |
+
gradio==3.34.0
|
54 |
+
gradio_client==0.2.6
|
55 |
+
greenlet==2.0.2
|
56 |
+
h11==0.14.0
|
57 |
+
hnswlib==0.7.0
|
58 |
+
httpcore==0.16.3
|
59 |
+
httptools==0.5.0
|
60 |
+
httpx==0.23.3
|
61 |
+
huggingface-hub==0.15.1
|
62 |
+
humanfriendly==10.0
|
63 |
+
idna==3.4
|
64 |
+
ipykernel==6.23.2
|
65 |
+
ipython==8.14.0
|
66 |
+
ipython-genutils==0.2.0
|
67 |
+
isoduration==20.11.0
|
68 |
+
jedi==0.18.2
|
69 |
+
Jinja2==3.1.2
|
70 |
+
jmespath==1.0.1
|
71 |
+
joblib==1.2.0
|
72 |
+
jsonpointer==2.3
|
73 |
+
jsonschema==4.17.3
|
74 |
+
jupyter-events==0.6.3
|
75 |
+
jupyter_client==8.2.0
|
76 |
+
jupyter_core==5.3.1
|
77 |
+
jupyter_server==2.6.0
|
78 |
+
jupyter_server_terminals==0.4.4
|
79 |
+
jupyterlab-pygments==0.2.2
|
80 |
+
kiwisolver==1.4.4
|
81 |
+
langchain==0.0.200
|
82 |
+
langchainplus-sdk==0.0.10
|
83 |
+
linkify-it-py==2.0.2
|
84 |
+
lxml==4.9.2
|
85 |
+
lz4==4.3.2
|
86 |
+
Markdown==3.4.3
|
87 |
+
markdown-it-py==2.2.0
|
88 |
+
MarkupSafe==2.1.3
|
89 |
+
marshmallow==3.19.0
|
90 |
+
marshmallow-enum==1.5.1
|
91 |
+
matplotlib==3.7.1
|
92 |
+
matplotlib-inline==0.1.6
|
93 |
+
mdit-py-plugins==0.3.3
|
94 |
+
mdurl==0.1.2
|
95 |
+
mistune==2.0.5
|
96 |
+
monotonic==1.6
|
97 |
+
mpmath==1.3.0
|
98 |
+
msg-parser==1.2.0
|
99 |
+
multidict==6.0.4
|
100 |
+
mypy-extensions==1.0.0
|
101 |
+
nbclassic==1.0.0
|
102 |
+
nbclient==0.8.0
|
103 |
+
nbconvert==7.5.0
|
104 |
+
nbformat==5.9.0
|
105 |
+
nest-asyncio==1.5.6
|
106 |
+
nltk==3.8.1
|
107 |
+
notebook==6.5.4
|
108 |
+
notebook_shim==0.2.3
|
109 |
+
numexpr==2.8.4
|
110 |
+
numpy==1.23.5
|
111 |
+
olefile==0.46
|
112 |
+
onnxruntime==1.15.0
|
113 |
+
openai==0.27.8
|
114 |
+
openapi-schema-pydantic==1.2.4
|
115 |
+
openpyxl==3.1.2
|
116 |
+
orjson==3.9.1
|
117 |
+
overrides==7.3.1
|
118 |
+
packaging==23.1
|
119 |
+
pandas==1.5.3
|
120 |
+
pandocfilters==1.5.0
|
121 |
+
parso==0.8.3
|
122 |
+
pdf2image==1.16.3
|
123 |
+
pdfminer.six==20221105
|
124 |
+
pickleshare==0.7.5
|
125 |
+
Pillow==9.5.0
|
126 |
+
pip-search==0.0.12
|
127 |
+
platformdirs==3.5.1
|
128 |
+
posthog==3.0.1
|
129 |
+
prometheus-client==0.17.0
|
130 |
+
prompt-toolkit==3.0.38
|
131 |
+
protobuf==4.23.2
|
132 |
+
psutil==5.9.5
|
133 |
+
pulsar-client==3.2.0
|
134 |
+
pure-eval==0.2.2
|
135 |
+
pycparser==2.21
|
136 |
+
pydantic==1.10.9
|
137 |
+
pydub==0.25.1
|
138 |
+
Pygments==2.15.1
|
139 |
+
pypandoc==1.11
|
140 |
+
pyparsing==3.0.9
|
141 |
+
pyreadline3==3.4.1
|
142 |
+
pyrsistent==0.19.3
|
143 |
+
python-dateutil==2.8.2
|
144 |
+
python-docx==0.8.11
|
145 |
+
python-dotenv==1.0.0
|
146 |
+
python-json-logger==2.0.7
|
147 |
+
python-magic==0.4.27
|
148 |
+
python-multipart==0.0.6
|
149 |
+
python-pptx==0.6.21
|
150 |
+
pytube==15.0.0
|
151 |
+
pytz==2023.3
|
152 |
+
pywin32==306
|
153 |
+
pywinpty==2.0.10
|
154 |
+
PyYAML==6.0
|
155 |
+
pyzmq==25.1.0
|
156 |
+
regex==2023.6.3
|
157 |
+
requests==2.31.0
|
158 |
+
rfc3339-validator==0.1.4
|
159 |
+
rfc3986==1.5.0
|
160 |
+
rfc3986-validator==0.1.1
|
161 |
+
rich==13.0.1
|
162 |
+
s3transfer==0.6.1
|
163 |
+
scikit-learn==1.2.2
|
164 |
+
scipy==1.10.1
|
165 |
+
semantic-version==2.10.0
|
166 |
+
Send2Trash==1.8.2
|
167 |
+
six==1.16.0
|
168 |
+
sklearn==0.0.post5
|
169 |
+
sniffio==1.3.0
|
170 |
+
soupsieve==2.4.1
|
171 |
+
SQLAlchemy==2.0.16
|
172 |
+
sqlitedict==2.1.0
|
173 |
+
stack-data==0.6.2
|
174 |
+
starlette==0.27.0
|
175 |
+
sympy==1.12
|
176 |
+
tabulate==0.9.0
|
177 |
+
tenacity==8.2.2
|
178 |
+
terminado==0.17.1
|
179 |
+
threadpoolctl==3.1.0
|
180 |
+
tiktoken==0.4.0
|
181 |
+
tinycss2==1.2.1
|
182 |
+
tokenizers==0.13.3
|
183 |
+
toolz==0.12.0
|
184 |
+
tornado==6.3.2
|
185 |
+
tqdm==4.65.0
|
186 |
+
traitlets==5.9.0
|
187 |
+
typer==0.9.0
|
188 |
+
typing-inspect==0.9.0
|
189 |
+
typing_extensions==4.6.3
|
190 |
+
tzdata==2023.3
|
191 |
+
uc-micro-py==1.0.2
|
192 |
+
unstructured==0.7.3
|
193 |
+
uri-template==1.2.0
|
194 |
+
urllib3==2.0.3
|
195 |
+
uvicorn==0.22.0
|
196 |
+
virtualenv==20.23.0
|
197 |
+
watchfiles==0.19.0
|
198 |
+
wcwidth==0.2.6
|
199 |
+
webcolors==1.13
|
200 |
+
webencodings==0.5.1
|
201 |
+
websocket-client==1.5.3
|
202 |
+
websockets==11.0.3
|
203 |
+
wrapt==1.14.1
|
204 |
+
xlrd==2.0.1
|
205 |
+
XlsxWriter==3.1.2
|
206 |
+
yarl==1.9.2
|
207 |
+
youtube-transcript-api==0.6.0
|
208 |
+
zstandard==0.21.0
|
run_local_server.bat
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
C:\Users\catsk\SourceCode\azure_openai_poc\venv\Scripts\activate
|
2 |
+
python C:\Users\catsk\SourceCode\azure_openai_poc\app.py server
|