Spaces:
Sleeping
Sleeping
GPTMonster
commited on
Commit
β’
88e6640
1
Parent(s):
454f920
Upload 12 files
Browse files- .gitattributes +3 -0
- README.md +8 -7
- __pycache__/azure_utils.cpython-310.pyc +0 -0
- __pycache__/polly_utils.cpython-310.pyc +0 -0
- app.py +949 -0
- audios/tempfile.mp3 +0 -0
- azure_utils.py +155 -0
- gitattributes (1).txt +36 -0
- images/Masahiro.png +3 -0
- polly_utils.py +635 -0
- requirements.txt +11 -0
- videos/Masahiro.mp4 +3 -0
- videos/tempfile.mp4 +3 -0
.gitattributes
CHANGED
@@ -32,3 +32,6 @@ saved_model/**/* 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
|
|
|
|
|
|
|
|
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
|
35 |
+
images/Masahiro.png filter=lfs diff=lfs merge=lfs -text
|
36 |
+
videos/Masahiro.mp4 filter=lfs diff=lfs merge=lfs -text
|
37 |
+
videos/tempfile.mp4 filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk:
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
-
license:
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: GPT+WolframAlpha+Whisper
|
3 |
+
emoji: π
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: gray
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.16.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
duplicated_from: JavaFXpert/Chat-GPT-LangChain
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
__pycache__/azure_utils.cpython-310.pyc
ADDED
Binary file (3.05 kB). View file
|
|
__pycache__/polly_utils.cpython-310.pyc
ADDED
Binary file (6.93 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,949 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import io
|
2 |
+
# import asyncio
|
3 |
+
import os
|
4 |
+
import ssl
|
5 |
+
from contextlib import closing
|
6 |
+
from typing import Optional, Tuple
|
7 |
+
import datetime
|
8 |
+
import promptlayer
|
9 |
+
promptlayer.api_key = os.environ.get("PROMPTLAYER_KEY")
|
10 |
+
|
11 |
+
import boto3
|
12 |
+
import gradio as gr
|
13 |
+
import requests
|
14 |
+
|
15 |
+
# UNCOMMENT TO USE WHISPER
|
16 |
+
import warnings
|
17 |
+
import whisper
|
18 |
+
|
19 |
+
from langchain import ConversationChain, LLMChain
|
20 |
+
|
21 |
+
from langchain.agents import load_tools, initialize_agent
|
22 |
+
from langchain.chains.conversation.memory import ConversationBufferMemory
|
23 |
+
# from langchain.llms import OpenAI
|
24 |
+
from promptlayer.langchain.llms import OpenAI
|
25 |
+
from threading import Lock
|
26 |
+
|
27 |
+
# Console to variable
|
28 |
+
from io import StringIO
|
29 |
+
import sys
|
30 |
+
import re
|
31 |
+
|
32 |
+
from openai.error import AuthenticationError, InvalidRequestError, RateLimitError
|
33 |
+
|
34 |
+
# Pertains to Express-inator functionality
|
35 |
+
from langchain.prompts import PromptTemplate
|
36 |
+
|
37 |
+
from polly_utils import PollyVoiceData, NEURAL_ENGINE
|
38 |
+
from azure_utils import AzureVoiceData
|
39 |
+
|
40 |
+
# Pertains to question answering functionality
|
41 |
+
from langchain.embeddings.openai import OpenAIEmbeddings
|
42 |
+
from langchain.text_splitter import CharacterTextSplitter
|
43 |
+
from langchain.vectorstores.faiss import FAISS
|
44 |
+
from langchain.docstore.document import Document
|
45 |
+
from langchain.chains.question_answering import load_qa_chain
|
46 |
+
|
47 |
+
# os.environ["NEWS_API_KEY"] = ""
|
48 |
+
# os.environ["TMDB_BEARER_TOKEN"] = ""
|
49 |
+
|
50 |
+
news_api_key = os.environ["NEWS_API_KEY"]
|
51 |
+
|
52 |
+
# news_api_key = "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"
|
53 |
+
# tmdb_bearer_token = os.environ["TMDB_BEARER_TOKEN"]
|
54 |
+
tmdb_bearer_token = "ef6345567bb53731af1fd359c5ed5ec9"
|
55 |
+
|
56 |
+
|
57 |
+
TOOLS_LIST = ['serpapi', 'wolfram-alpha', 'pal-math', 'pal-colored-objects', 'news-api'] #'google-search','news-api','tmdb-api','open-meteo-api'
|
58 |
+
TOOLS_DEFAULT_LIST = ['serpapi', 'wolfram-alpha', 'pal-math', 'pal-colored-objects', 'news-api']
|
59 |
+
BUG_FOUND_MSG = "Error in the return response. Please try again."
|
60 |
+
# AUTH_ERR_MSG = "Please paste your OpenAI key from openai.com to use this application. It is not necessary to hit a button or key after pasting it."
|
61 |
+
AUTH_ERR_MSG = "Please paste your OpenAI key from openai.com to use this application. "
|
62 |
+
MAX_TOKENS = 2048
|
63 |
+
|
64 |
+
LOOPING_TALKING_HEAD = "videos/Masahiro.mp4"
|
65 |
+
TALKING_HEAD_WIDTH = "192"
|
66 |
+
MAX_TALKING_HEAD_TEXT_LENGTH = 155
|
67 |
+
|
68 |
+
# Pertains to Express-inator functionality
|
69 |
+
NUM_WORDS_DEFAULT = 0
|
70 |
+
MAX_WORDS = 400
|
71 |
+
FORMALITY_DEFAULT = "N/A"
|
72 |
+
TEMPERATURE_DEFAULT = 0.5
|
73 |
+
EMOTION_DEFAULT = "N/A"
|
74 |
+
LANG_LEVEL_DEFAULT = "N/A"
|
75 |
+
TRANSLATE_TO_DEFAULT = "N/A"
|
76 |
+
LITERARY_STYLE_DEFAULT = "N/A"
|
77 |
+
PROMPT_TEMPLATE = PromptTemplate(
|
78 |
+
input_variables=["original_words", "num_words", "formality", "emotions", "lang_level", "translate_to",
|
79 |
+
"literary_style"],
|
80 |
+
template="Restate {num_words}{formality}{emotions}{lang_level}{translate_to}{literary_style}the following: \n{original_words}\n",
|
81 |
+
)
|
82 |
+
|
83 |
+
POLLY_VOICE_DATA = PollyVoiceData()
|
84 |
+
AZURE_VOICE_DATA = AzureVoiceData()
|
85 |
+
|
86 |
+
# Pertains to WHISPER functionality
|
87 |
+
WHISPER_DETECT_LANG = "Detect language"
|
88 |
+
|
89 |
+
|
90 |
+
# UNCOMMENT TO USE WHISPER
|
91 |
+
warnings.filterwarnings("ignore")
|
92 |
+
WHISPER_MODEL = whisper.load_model("tiny")
|
93 |
+
print("WHISPER_MODEL", WHISPER_MODEL)
|
94 |
+
|
95 |
+
|
96 |
+
# UNCOMMENT TO USE WHISPER
|
97 |
+
def transcribe(aud_inp, whisper_lang):
|
98 |
+
if aud_inp is None:
|
99 |
+
return ""
|
100 |
+
aud = whisper.load_audio(aud_inp)
|
101 |
+
aud = whisper.pad_or_trim(aud)
|
102 |
+
mel = whisper.log_mel_spectrogram(aud).to(WHISPER_MODEL.device)
|
103 |
+
_, probs = WHISPER_MODEL.detect_language(mel)
|
104 |
+
options = whisper.DecodingOptions()
|
105 |
+
if whisper_lang != WHISPER_DETECT_LANG:
|
106 |
+
whisper_lang_code = POLLY_VOICE_DATA.get_whisper_lang_code(whisper_lang)
|
107 |
+
options = whisper.DecodingOptions(language=whisper_lang_code)
|
108 |
+
result = whisper.decode(WHISPER_MODEL, mel, options)
|
109 |
+
print("result.text", result.text)
|
110 |
+
result_text = ""
|
111 |
+
if result and result.text:
|
112 |
+
result_text = result.text
|
113 |
+
return result_text
|
114 |
+
|
115 |
+
|
116 |
+
# Temporarily address Wolfram Alpha SSL certificate issue
|
117 |
+
ssl._create_default_https_context = ssl._create_unverified_context
|
118 |
+
|
119 |
+
|
120 |
+
# TEMPORARY FOR TESTING
|
121 |
+
def transcribe_dummy(aud_inp_tb, whisper_lang):
|
122 |
+
if aud_inp_tb is None:
|
123 |
+
return ""
|
124 |
+
# aud = whisper.load_audio(aud_inp)
|
125 |
+
# aud = whisper.pad_or_trim(aud)
|
126 |
+
# mel = whisper.log_mel_spectrogram(aud).to(WHISPER_MODEL.device)
|
127 |
+
# _, probs = WHISPER_MODEL.detect_language(mel)
|
128 |
+
# options = whisper.DecodingOptions()
|
129 |
+
# options = whisper.DecodingOptions(language="ja")
|
130 |
+
# result = whisper.decode(WHISPER_MODEL, mel, options)
|
131 |
+
result_text = "Whisper will detect language"
|
132 |
+
if whisper_lang != WHISPER_DETECT_LANG:
|
133 |
+
whisper_lang_code = POLLY_VOICE_DATA.get_whisper_lang_code(whisper_lang)
|
134 |
+
result_text = f"Whisper will use lang code: {whisper_lang_code}"
|
135 |
+
print("result_text", result_text)
|
136 |
+
return aud_inp_tb
|
137 |
+
|
138 |
+
|
139 |
+
# Pertains to Express-inator functionality
|
140 |
+
def transform_text(desc, express_chain, num_words, formality,
|
141 |
+
anticipation_level, joy_level, trust_level,
|
142 |
+
fear_level, surprise_level, sadness_level, disgust_level, anger_level,
|
143 |
+
lang_level, translate_to, literary_style):
|
144 |
+
num_words_prompt = ""
|
145 |
+
if num_words and int(num_words) != 0:
|
146 |
+
num_words_prompt = "using up to " + str(num_words) + " words, "
|
147 |
+
|
148 |
+
# Change some arguments to lower case
|
149 |
+
formality = formality.lower()
|
150 |
+
anticipation_level = anticipation_level.lower()
|
151 |
+
joy_level = joy_level.lower()
|
152 |
+
trust_level = trust_level.lower()
|
153 |
+
fear_level = fear_level.lower()
|
154 |
+
surprise_level = surprise_level.lower()
|
155 |
+
sadness_level = sadness_level.lower()
|
156 |
+
disgust_level = disgust_level.lower()
|
157 |
+
anger_level = anger_level.lower()
|
158 |
+
|
159 |
+
formality_str = ""
|
160 |
+
if formality != "n/a":
|
161 |
+
formality_str = "in a " + formality + " manner, "
|
162 |
+
|
163 |
+
# put all emotions into a list
|
164 |
+
emotions = []
|
165 |
+
if anticipation_level != "n/a":
|
166 |
+
emotions.append(anticipation_level)
|
167 |
+
if joy_level != "n/a":
|
168 |
+
emotions.append(joy_level)
|
169 |
+
if trust_level != "n/a":
|
170 |
+
emotions.append(trust_level)
|
171 |
+
if fear_level != "n/a":
|
172 |
+
emotions.append(fear_level)
|
173 |
+
if surprise_level != "n/a":
|
174 |
+
emotions.append(surprise_level)
|
175 |
+
if sadness_level != "n/a":
|
176 |
+
emotions.append(sadness_level)
|
177 |
+
if disgust_level != "n/a":
|
178 |
+
emotions.append(disgust_level)
|
179 |
+
if anger_level != "n/a":
|
180 |
+
emotions.append(anger_level)
|
181 |
+
|
182 |
+
emotions_str = ""
|
183 |
+
if len(emotions) > 0:
|
184 |
+
if len(emotions) == 1:
|
185 |
+
emotions_str = "with emotion of " + emotions[0] + ", "
|
186 |
+
else:
|
187 |
+
emotions_str = "with emotions of " + ", ".join(emotions[:-1]) + " and " + emotions[-1] + ", "
|
188 |
+
|
189 |
+
lang_level_str = ""
|
190 |
+
if lang_level != LANG_LEVEL_DEFAULT:
|
191 |
+
lang_level_str = "at a " + lang_level + " level, " if translate_to == TRANSLATE_TO_DEFAULT else ""
|
192 |
+
|
193 |
+
translate_to_str = ""
|
194 |
+
if translate_to != TRANSLATE_TO_DEFAULT:
|
195 |
+
translate_to_str = "translated to " + (
|
196 |
+
"" if lang_level == TRANSLATE_TO_DEFAULT else lang_level + " level ") + translate_to + ", "
|
197 |
+
|
198 |
+
literary_style_str = ""
|
199 |
+
if literary_style != LITERARY_STYLE_DEFAULT:
|
200 |
+
if literary_style == "Prose":
|
201 |
+
literary_style_str = "as prose, "
|
202 |
+
if literary_style == "Story":
|
203 |
+
literary_style_str = "as a story, "
|
204 |
+
elif literary_style == "Summary":
|
205 |
+
literary_style_str = "as a summary, "
|
206 |
+
elif literary_style == "Outline":
|
207 |
+
literary_style_str = "as an outline numbers and lower case letters, "
|
208 |
+
elif literary_style == "Bullets":
|
209 |
+
literary_style_str = "as bullet points using bullets, "
|
210 |
+
elif literary_style == "Poetry":
|
211 |
+
literary_style_str = "as a poem, "
|
212 |
+
elif literary_style == "Haiku":
|
213 |
+
literary_style_str = "as a haiku, "
|
214 |
+
elif literary_style == "Limerick":
|
215 |
+
literary_style_str = "as a limerick, "
|
216 |
+
elif literary_style == "Rap":
|
217 |
+
literary_style_str = "as a rap, "
|
218 |
+
elif literary_style == "Joke":
|
219 |
+
literary_style_str = "as a very funny joke with a setup and punchline, "
|
220 |
+
elif literary_style == "Knock-knock":
|
221 |
+
literary_style_str = "as a very funny knock-knock joke, "
|
222 |
+
elif literary_style == "FAQ":
|
223 |
+
literary_style_str = "as a FAQ with several questions and answers, "
|
224 |
+
|
225 |
+
formatted_prompt = PROMPT_TEMPLATE.format(
|
226 |
+
original_words=desc,
|
227 |
+
num_words=num_words_prompt,
|
228 |
+
formality=formality_str,
|
229 |
+
emotions=emotions_str,
|
230 |
+
lang_level=lang_level_str,
|
231 |
+
translate_to=translate_to_str,
|
232 |
+
literary_style=literary_style_str
|
233 |
+
)
|
234 |
+
|
235 |
+
trans_instr = num_words_prompt + formality_str + emotions_str + lang_level_str + translate_to_str + literary_style_str
|
236 |
+
if express_chain and len(trans_instr.strip()) > 0:
|
237 |
+
generated_text = express_chain.run(
|
238 |
+
{'original_words': desc, 'num_words': num_words_prompt, 'formality': formality_str,
|
239 |
+
'emotions': emotions_str, 'lang_level': lang_level_str, 'translate_to': translate_to_str,
|
240 |
+
'literary_style': literary_style_str}).strip()
|
241 |
+
else:
|
242 |
+
print("Not transforming text")
|
243 |
+
generated_text = desc
|
244 |
+
|
245 |
+
# replace all newlines with <br> in generated_text
|
246 |
+
generated_text = generated_text.replace("\n", "\n\n")
|
247 |
+
|
248 |
+
prompt_plus_generated = "GPT prompt: " + formatted_prompt + "\n\n" + generated_text
|
249 |
+
|
250 |
+
print("\n==== date/time: " + str(datetime.datetime.now() - datetime.timedelta(hours=5)) + " ====")
|
251 |
+
print("prompt_plus_generated: " + prompt_plus_generated)
|
252 |
+
|
253 |
+
return generated_text
|
254 |
+
|
255 |
+
|
256 |
+
def load_chain(tools_list, llm):
|
257 |
+
chain = None
|
258 |
+
express_chain = None
|
259 |
+
memory = None
|
260 |
+
if llm:
|
261 |
+
print("\ntools_list", tools_list)
|
262 |
+
tool_names = tools_list
|
263 |
+
tools = load_tools(tool_names, llm=llm, news_api_key=news_api_key, tmdb_bearer_token=tmdb_bearer_token)
|
264 |
+
|
265 |
+
memory = ConversationBufferMemory(memory_key="chat_history")
|
266 |
+
|
267 |
+
chain = initialize_agent(tools, llm, agent="conversational-react-description", verbose=True, memory=memory)
|
268 |
+
express_chain = LLMChain(llm=llm, prompt=PROMPT_TEMPLATE, verbose=True)
|
269 |
+
return chain, express_chain, memory
|
270 |
+
|
271 |
+
|
272 |
+
# async def set_chain_state_api_key(api_key):
|
273 |
+
# def set_openai_key(api_key):
|
274 |
+
# Set the API key for chain_state
|
275 |
+
# chain_state.api_key = api_key
|
276 |
+
|
277 |
+
# async def set_express_chain_state_api_key(api_key):
|
278 |
+
# # Set the API key for express_chain_state
|
279 |
+
# express_chain_state.api_key = api_key
|
280 |
+
|
281 |
+
# async def set_llm_state_api_key(api_key):
|
282 |
+
# Set the API key for llm_state
|
283 |
+
# llm_state.api_key = api_key
|
284 |
+
|
285 |
+
# async def set_embeddings_state_api_key(api_key):
|
286 |
+
# Set the API key for embeddings_state
|
287 |
+
# embeddings_state.api_key = api_key
|
288 |
+
|
289 |
+
# async def set_qa_chain_state_api_key(api_key):
|
290 |
+
# Set the API key for qa_chain_state
|
291 |
+
# qa_chain_state.api_key = api_key
|
292 |
+
|
293 |
+
# async def set_memory_state_api_key(api_key):
|
294 |
+
# Set the API key for memory_state
|
295 |
+
# memory_state.api_key = api_key
|
296 |
+
def set_openai_api_key(api_key):
|
297 |
+
if api_key and api_key.startswith("sk-") and len(api_key) > 50:
|
298 |
+
os.environ["OPENAI_API_KEY"] = api_key
|
299 |
+
print("\n\n ++++++++++++++ Setting OpenAI API key ++++++++++++++ \n\n")
|
300 |
+
print(str(datetime.datetime.now()) + ": Before OpenAI, OPENAI_API_KEY length: " + str(
|
301 |
+
len(os.environ["OPENAI_API_KEY"])))
|
302 |
+
llm = OpenAI(temperature=0, max_tokens=MAX_TOKENS)
|
303 |
+
print(str(datetime.datetime.now()) + ": After OpenAI, OPENAI_API_KEY length: " + str(
|
304 |
+
len(os.environ["OPENAI_API_KEY"])))
|
305 |
+
chain, express_chain, memory = load_chain(TOOLS_DEFAULT_LIST, llm)
|
306 |
+
|
307 |
+
# Pertains to question answering functionality
|
308 |
+
embeddings = OpenAIEmbeddings()
|
309 |
+
qa_chain = load_qa_chain(OpenAI(temperature=0), chain_type="stuff")
|
310 |
+
|
311 |
+
print(str(datetime.datetime.now()) + ": After load_chain, OPENAI_API_KEY length: " + str(
|
312 |
+
len(os.environ["OPENAI_API_KEY"])))
|
313 |
+
os.environ["OPENAI_API_KEY"] = ""
|
314 |
+
return chain, express_chain, llm, embeddings, qa_chain, memory
|
315 |
+
return None, None, None, None, None, None
|
316 |
+
|
317 |
+
PROMPTLAYER_API_BASE = "https://api.promptlayer.com"
|
318 |
+
|
319 |
+
def run_chain(chain, inp, capture_hidden_text):
|
320 |
+
output = ""
|
321 |
+
hidden_text = None
|
322 |
+
if capture_hidden_text:
|
323 |
+
error_msg = None
|
324 |
+
tmp = sys.stdout
|
325 |
+
hidden_text_io = StringIO()
|
326 |
+
sys.stdout = hidden_text_io
|
327 |
+
|
328 |
+
try:
|
329 |
+
output = chain.run(input=inp)
|
330 |
+
except AuthenticationError as ae:
|
331 |
+
error_msg = AUTH_ERR_MSG + str(datetime.datetime.now()) + ". " + str(ae)
|
332 |
+
print("error_msg", error_msg)
|
333 |
+
except RateLimitError as rle:
|
334 |
+
error_msg = "\n\nRateLimitError: " + str(rle)
|
335 |
+
except ValueError as ve:
|
336 |
+
error_msg = "\n\nValueError: " + str(ve)
|
337 |
+
except InvalidRequestError as ire:
|
338 |
+
error_msg = "\n\nInvalidRequestError: " + str(ire)
|
339 |
+
except Exception as e:
|
340 |
+
error_msg = "\n\n" + BUG_FOUND_MSG + ":\n\n" + str(e)
|
341 |
+
|
342 |
+
sys.stdout = tmp
|
343 |
+
hidden_text = hidden_text_io.getvalue()
|
344 |
+
|
345 |
+
# remove escape characters from hidden_text
|
346 |
+
hidden_text = re.sub(r'\x1b[^m]*m', '', hidden_text)
|
347 |
+
|
348 |
+
# remove "Entering new AgentExecutor chain..." from hidden_text
|
349 |
+
hidden_text = re.sub(r"Entering new AgentExecutor chain...\n", "", hidden_text)
|
350 |
+
|
351 |
+
# remove "Finished chain." from hidden_text
|
352 |
+
hidden_text = re.sub(r"Finished chain.", "", hidden_text)
|
353 |
+
|
354 |
+
# Add newline after "Thought:" "Action:" "Observation:" "Input:" and "AI:"
|
355 |
+
hidden_text = re.sub(r"Thought:", "\n\nThought:", hidden_text)
|
356 |
+
hidden_text = re.sub(r"Action:", "\n\nAction:", hidden_text)
|
357 |
+
hidden_text = re.sub(r"Observation:", "\n\nObservation:", hidden_text)
|
358 |
+
hidden_text = re.sub(r"Input:", "\n\nInput:", hidden_text)
|
359 |
+
hidden_text = re.sub(r"AI:", "\n\nAI:", hidden_text)
|
360 |
+
|
361 |
+
if error_msg:
|
362 |
+
hidden_text += error_msg
|
363 |
+
|
364 |
+
print("hidden_text: ", hidden_text)
|
365 |
+
else:
|
366 |
+
try:
|
367 |
+
output = chain.run(input=inp)
|
368 |
+
except AuthenticationError as ae:
|
369 |
+
output = AUTH_ERR_MSG + str(datetime.datetime.now()) + ". " + str(ae)
|
370 |
+
print("output", output)
|
371 |
+
except RateLimitError as rle:
|
372 |
+
output = "\n\nRateLimitError: " + str(rle)
|
373 |
+
except ValueError as ve:
|
374 |
+
output = "\n\nValueError: " + str(ve)
|
375 |
+
except InvalidRequestError as ire:
|
376 |
+
output = "\n\nInvalidRequestError: " + str(ire)
|
377 |
+
except Exception as e:
|
378 |
+
output = "\n\n" + BUG_FOUND_MSG + ":\n\n" + str(e)
|
379 |
+
|
380 |
+
return output, hidden_text
|
381 |
+
|
382 |
+
|
383 |
+
def reset_memory(history, memory):
|
384 |
+
memory.clear()
|
385 |
+
history = []
|
386 |
+
return history, history, memory
|
387 |
+
|
388 |
+
|
389 |
+
class ChatWrapper:
|
390 |
+
|
391 |
+
def __init__(self):
|
392 |
+
self.lock = Lock()
|
393 |
+
|
394 |
+
def __call__(
|
395 |
+
self, api_key: str, inp: str, history: Optional[Tuple[str, str]], chain: Optional[ConversationChain],
|
396 |
+
trace_chain: bool, speak_text: bool, talking_head: bool, monologue: bool, express_chain: Optional[LLMChain],
|
397 |
+
num_words, formality, anticipation_level, joy_level, trust_level,
|
398 |
+
fear_level, surprise_level, sadness_level, disgust_level, anger_level,
|
399 |
+
lang_level, translate_to, literary_style, qa_chain, docsearch, use_embeddings
|
400 |
+
):
|
401 |
+
"""Execute the chat functionality."""
|
402 |
+
self.lock.acquire()
|
403 |
+
try:
|
404 |
+
print("\n==== date/time: " + str(datetime.datetime.now()) + " ====")
|
405 |
+
print("inp: " + inp)
|
406 |
+
print("trace_chain: ", trace_chain)
|
407 |
+
print("speak_text: ", speak_text)
|
408 |
+
print("talking_head: ", talking_head)
|
409 |
+
print("monologue: ", monologue)
|
410 |
+
history = history or []
|
411 |
+
# If chain is None, that is because no API key was provided.
|
412 |
+
output = "Please paste your OpenAI key from openai.com to use this app. " + str(datetime.datetime.now())
|
413 |
+
hidden_text = output
|
414 |
+
|
415 |
+
if chain:
|
416 |
+
# Set OpenAI key
|
417 |
+
import openai
|
418 |
+
openai.api_key = api_key
|
419 |
+
if not monologue:
|
420 |
+
if use_embeddings:
|
421 |
+
if inp and inp.strip() != "":
|
422 |
+
if docsearch:
|
423 |
+
docs = docsearch.similarity_search(inp)
|
424 |
+
output = str(qa_chain.run(input_documents=docs, question=inp))
|
425 |
+
else:
|
426 |
+
output, hidden_text = "Please supply some text in the the Embeddings tab.", None
|
427 |
+
else:
|
428 |
+
output, hidden_text = "What's on your mind?", None
|
429 |
+
else:
|
430 |
+
output, hidden_text = run_chain(chain, inp, capture_hidden_text=trace_chain)
|
431 |
+
else:
|
432 |
+
output, hidden_text = inp, None
|
433 |
+
|
434 |
+
output = transform_text(output, express_chain, num_words, formality, anticipation_level, joy_level,
|
435 |
+
trust_level,
|
436 |
+
fear_level, surprise_level, sadness_level, disgust_level, anger_level,
|
437 |
+
lang_level, translate_to, literary_style)
|
438 |
+
|
439 |
+
text_to_display = output
|
440 |
+
if trace_chain:
|
441 |
+
text_to_display = hidden_text + "\n\n" + output
|
442 |
+
history.append((inp, text_to_display))
|
443 |
+
|
444 |
+
html_video, temp_file, html_audio, temp_aud_file = None, None, None, None
|
445 |
+
if speak_text:
|
446 |
+
if talking_head:
|
447 |
+
if len(output) <= MAX_TALKING_HEAD_TEXT_LENGTH:
|
448 |
+
html_video, temp_file = do_html_video_speak(output, translate_to)
|
449 |
+
else:
|
450 |
+
temp_file = LOOPING_TALKING_HEAD
|
451 |
+
html_video = create_html_video(temp_file, TALKING_HEAD_WIDTH)
|
452 |
+
html_audio, temp_aud_file = do_html_audio_speak(output, translate_to)
|
453 |
+
else:
|
454 |
+
html_audio, temp_aud_file = do_html_audio_speak(output, translate_to)
|
455 |
+
else:
|
456 |
+
if talking_head:
|
457 |
+
temp_file = LOOPING_TALKING_HEAD
|
458 |
+
html_video = create_html_video(temp_file, TALKING_HEAD_WIDTH)
|
459 |
+
else:
|
460 |
+
# html_audio, temp_aud_file = do_html_audio_speak(output, translate_to)
|
461 |
+
# html_video = create_html_video(temp_file, "128")
|
462 |
+
pass
|
463 |
+
|
464 |
+
except Exception as e:
|
465 |
+
raise e
|
466 |
+
finally:
|
467 |
+
self.lock.release()
|
468 |
+
return history, history, html_video, temp_file, html_audio, temp_aud_file, ""
|
469 |
+
# return history, history, html_audio, temp_aud_file, ""
|
470 |
+
|
471 |
+
|
472 |
+
chat = ChatWrapper()
|
473 |
+
|
474 |
+
|
475 |
+
def do_html_audio_speak(words_to_speak, polly_language):
|
476 |
+
polly_client = boto3.Session(
|
477 |
+
aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
|
478 |
+
aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
|
479 |
+
region_name=os.environ["AWS_DEFAULT_REGION"]
|
480 |
+
).client('polly')
|
481 |
+
|
482 |
+
# voice_id, language_code, engine = POLLY_VOICE_DATA.get_voice(polly_language, "Female")
|
483 |
+
voice_id, language_code, engine = POLLY_VOICE_DATA.get_voice(polly_language, "Male")
|
484 |
+
if not voice_id:
|
485 |
+
# voice_id = "Joanna"
|
486 |
+
voice_id = "Matthew"
|
487 |
+
language_code = "en-US"
|
488 |
+
engine = NEURAL_ENGINE
|
489 |
+
response = polly_client.synthesize_speech(
|
490 |
+
Text=words_to_speak,
|
491 |
+
OutputFormat='mp3',
|
492 |
+
VoiceId=voice_id,
|
493 |
+
LanguageCode=language_code,
|
494 |
+
Engine=engine
|
495 |
+
)
|
496 |
+
|
497 |
+
html_audio = '<pre>no audio</pre>'
|
498 |
+
|
499 |
+
# Save the audio stream returned by Amazon Polly on Lambda's temp directory
|
500 |
+
if "AudioStream" in response:
|
501 |
+
with closing(response["AudioStream"]) as stream:
|
502 |
+
# output = os.path.join("/tmp/", "speech.mp3")
|
503 |
+
|
504 |
+
try:
|
505 |
+
with open('audios/tempfile.mp3', 'wb') as f:
|
506 |
+
f.write(stream.read())
|
507 |
+
temp_aud_file = gr.File("audios/tempfile.mp3")
|
508 |
+
temp_aud_file_url = "/file=" + temp_aud_file.value['name']
|
509 |
+
html_audio = f'<audio autoplay><source src={temp_aud_file_url} type="audio/mp3"></audio>'
|
510 |
+
except IOError as error:
|
511 |
+
# Could not write to file, exit gracefully
|
512 |
+
print(error)
|
513 |
+
return None, None
|
514 |
+
else:
|
515 |
+
# The response didn't contain audio data, exit gracefully
|
516 |
+
print("Could not stream audio")
|
517 |
+
return None, None
|
518 |
+
|
519 |
+
return html_audio, "audios/tempfile.mp3"
|
520 |
+
|
521 |
+
|
522 |
+
# def create_html_video(file_name, width):
|
523 |
+
# temp_file_url = "/file=" + tmp_file.value['name']
|
524 |
+
# html_video = f'<video width={width} height={width} autoplay muted loop><source src={temp_file_url} type="video/mp4" poster="Masahiro.png"></video>'
|
525 |
+
# return html_video
|
526 |
+
|
527 |
+
|
528 |
+
def do_html_video_speak(words_to_speak, azure_language):
|
529 |
+
azure_voice = AZURE_VOICE_DATA.get_voice(azure_language, "Male")
|
530 |
+
if not azure_voice:
|
531 |
+
azure_voice = "en-US-ChristopherNeural"
|
532 |
+
|
533 |
+
headers = {"Authorization": f"Bearer {os.environ['EXHUMAN_API_KEY']}"}
|
534 |
+
body = {
|
535 |
+
'bot_name': 'Masahiro',
|
536 |
+
'bot_response': words_to_speak,
|
537 |
+
'azure_voice': azure_voice,
|
538 |
+
'azure_style': 'friendly',
|
539 |
+
'animation_pipeline': 'high_speed',
|
540 |
+
}
|
541 |
+
api_endpoint = "https://api.exh.ai/animations/v1/generate_lipsync"
|
542 |
+
res = requests.post(api_endpoint, json=body, headers=headers)
|
543 |
+
print("res.status_code: ", res.status_code)
|
544 |
+
|
545 |
+
html_video = '<pre>no video</pre>'
|
546 |
+
if isinstance(res.content, bytes):
|
547 |
+
response_stream = io.BytesIO(res.content)
|
548 |
+
print("len(res.content)): ", len(res.content))
|
549 |
+
|
550 |
+
with open('videos/tempfile.mp4', 'wb') as f:
|
551 |
+
f.write(response_stream.read())
|
552 |
+
temp_file = gr.File("videos/tempfile.mp4")
|
553 |
+
temp_file_url = "/file=" + temp_file.value['name']
|
554 |
+
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>'
|
555 |
+
else:
|
556 |
+
print('video url unknown')
|
557 |
+
return html_video, "videos/tempfile.mp4"
|
558 |
+
|
559 |
+
|
560 |
+
def update_selected_tools(widget, state, llm):
|
561 |
+
if widget:
|
562 |
+
state = widget
|
563 |
+
chain, express_chain, memory = load_chain(state, llm)
|
564 |
+
return state, llm, chain, express_chain
|
565 |
+
|
566 |
+
|
567 |
+
# def update_talking_head(widget, state):
|
568 |
+
# if widget:
|
569 |
+
# state = widget
|
570 |
+
|
571 |
+
# video_html_talking_head = create_html_video(LOOPING_TALKING_HEAD, TALKING_HEAD_WIDTH)
|
572 |
+
# return state, video_html_talking_head
|
573 |
+
# else:
|
574 |
+
# # return state, create_html_video(LOOPING_TALKING_HEAD, "32")
|
575 |
+
# return None, "<pre></pre>"
|
576 |
+
|
577 |
+
|
578 |
+
def update_foo(widget, state):
|
579 |
+
if widget:
|
580 |
+
state = widget
|
581 |
+
return state
|
582 |
+
|
583 |
+
|
584 |
+
# Pertains to question answering functionality
|
585 |
+
def update_embeddings(embeddings_text, embeddings, qa_chain):
|
586 |
+
if embeddings_text:
|
587 |
+
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
|
588 |
+
texts = text_splitter.split_text(embeddings_text)
|
589 |
+
|
590 |
+
docsearch = FAISS.from_texts(texts, embeddings)
|
591 |
+
print("Embeddings updated")
|
592 |
+
return docsearch
|
593 |
+
|
594 |
+
|
595 |
+
# Pertains to question answering functionality
|
596 |
+
def update_use_embeddings(widget, state):
|
597 |
+
if widget:
|
598 |
+
state = widget
|
599 |
+
return state
|
600 |
+
|
601 |
+
|
602 |
+
|
603 |
+
|
604 |
+
with gr.Blocks(css=".gradio-container {background-color: lightgray}") as block:
|
605 |
+
llm_state = gr.State()
|
606 |
+
history_state = gr.State()
|
607 |
+
chain_state = gr.State()
|
608 |
+
express_chain_state = gr.State()
|
609 |
+
tools_list_state = gr.State(TOOLS_DEFAULT_LIST)
|
610 |
+
trace_chain_state = gr.State(False)
|
611 |
+
speak_text_state = gr.State(False)
|
612 |
+
talking_head_state = gr.State(True)
|
613 |
+
monologue_state = gr.State(False) # Takes the input and repeats it back to the user, optionally transforming it.
|
614 |
+
memory_state = gr.State()
|
615 |
+
|
616 |
+
# Pertains to Express-inator functionality
|
617 |
+
num_words_state = gr.State(NUM_WORDS_DEFAULT)
|
618 |
+
formality_state = gr.State(FORMALITY_DEFAULT)
|
619 |
+
anticipation_level_state = gr.State(EMOTION_DEFAULT)
|
620 |
+
joy_level_state = gr.State(EMOTION_DEFAULT)
|
621 |
+
trust_level_state = gr.State(EMOTION_DEFAULT)
|
622 |
+
fear_level_state = gr.State(EMOTION_DEFAULT)
|
623 |
+
surprise_level_state = gr.State(EMOTION_DEFAULT)
|
624 |
+
sadness_level_state = gr.State(EMOTION_DEFAULT)
|
625 |
+
disgust_level_state = gr.State(EMOTION_DEFAULT)
|
626 |
+
anger_level_state = gr.State(EMOTION_DEFAULT)
|
627 |
+
lang_level_state = gr.State(LANG_LEVEL_DEFAULT)
|
628 |
+
translate_to_state = gr.State(TRANSLATE_TO_DEFAULT)
|
629 |
+
literary_style_state = gr.State(LITERARY_STYLE_DEFAULT)
|
630 |
+
|
631 |
+
# Pertains to WHISPER functionality
|
632 |
+
whisper_lang_state = gr.State(WHISPER_DETECT_LANG)
|
633 |
+
|
634 |
+
# Pertains to question answering functionality
|
635 |
+
embeddings_state = gr.State()
|
636 |
+
qa_chain_state = gr.State()
|
637 |
+
docsearch_state = gr.State()
|
638 |
+
use_embeddings_state = gr.State(False)
|
639 |
+
|
640 |
+
with gr.Tab("Chat"):
|
641 |
+
with gr.Row():
|
642 |
+
with gr.Column():
|
643 |
+
gr.HTML(
|
644 |
+
"""<b><center>KB Prototype </center></b>
|
645 |
+
<p><center><b>GPT-Monster Gym
|
646 |
+
</b></center></p>""")
|
647 |
+
|
648 |
+
openai_api_key_textbox = gr.Textbox(placeholder="sk-... μμνλ OpenAI API key λΆμ¬λ£κΈ°",
|
649 |
+
show_label=False, lines=1, type='password', elem_id="openai_api_key_textbox")
|
650 |
+
|
651 |
+
with gr.Row():
|
652 |
+
with gr.Column(scale=1, min_width=TALKING_HEAD_WIDTH, visible=True):
|
653 |
+
speak_text_cb = gr.Checkbox(label="μμ±κΈ°λ₯", value=False)
|
654 |
+
speak_text_cb.change(update_foo, inputs=[speak_text_cb, speak_text_state],
|
655 |
+
outputs=[speak_text_state])
|
656 |
+
|
657 |
+
# my_file = gr.File(label="Upload a file", type="file", visible=False)
|
658 |
+
# tmp_file = gr.File(LOOPING_TALKING_HEAD, visible=False)
|
659 |
+
# # tmp_file_url = "/file=" + tmp_file.value['name']
|
660 |
+
# htm_video = create_html_video(LOOPING_TALKING_HEAD, TALKING_HEAD_WIDTH)
|
661 |
+
# video_html = gr.HTML(htm_video)
|
662 |
+
|
663 |
+
# my_aud_file = gr.File(label="Audio file", type="file", visible=True)
|
664 |
+
tmp_aud_file = gr.File("audios/tempfile.mp3", visible=False)
|
665 |
+
tmp_aud_file_url = "/file=" + tmp_aud_file.value['name']
|
666 |
+
htm_audio = f'<audio><source src={tmp_aud_file_url} type="audio/mp3"></audio>'
|
667 |
+
audio_html = gr.HTML(htm_audio)
|
668 |
+
|
669 |
+
with gr.Column(scale=7):
|
670 |
+
chatbot = gr.Chatbot()
|
671 |
+
|
672 |
+
with gr.Row():
|
673 |
+
message = gr.Textbox(label="μ€λ μ μ¬μ μ΄λ»κ² ν κΉμ?",
|
674 |
+
placeholder="μ§κΈ λ μ€λ μκ°μ νλ² λ§ν΄ 보μΈμ",
|
675 |
+
lines=1)
|
676 |
+
submit = gr.Button(value="Send", variant="secondary").style(full_width=False)
|
677 |
+
|
678 |
+
# UNCOMMENT TO USE WHISPER
|
679 |
+
with gr.Row():
|
680 |
+
audio_comp = gr.Microphone(source="microphone", type="filepath", label="κ·Έλ₯ λ§ν΄λ΄!",
|
681 |
+
interactive=True, streaming=False)
|
682 |
+
audio_comp.change(transcribe, inputs=[audio_comp, whisper_lang_state], outputs=[message])
|
683 |
+
|
684 |
+
# TEMPORARY FOR TESTING
|
685 |
+
# with gr.Row():
|
686 |
+
# audio_comp_tb = gr.Textbox(label="Just say it!", lines=1)
|
687 |
+
# audio_comp_tb.submit(transcribe_dummy, inputs=[audio_comp_tb, whisper_lang_state], outputs=[message])
|
688 |
+
|
689 |
+
gr.Examples(
|
690 |
+
examples=["μ
λ ₯λ λ΄μ©μ μμ΄λ‘ μμ°μ€λ½κ² ννμΌλ‘ λ§ν΄ μ£ΌμΈμ",
|
691 |
+
"μ
λ ₯ν μ½κ΄ λ΄μ©μ μ λ¨Έλ¬μ€νκ² ννν΄ μ£ΌμΈμ",
|
692 |
+
"SQL쿼리λ₯Ό νλν΄ μ£ΌμΈμνμ΄μ¬μ½λλ₯Ό μμ ν΄ μ£ΌμΈμ",
|
693 |
+
"νμ΄μ¬μΌλ‘ μΉμ€ν¬λν μ½λλ₯Ό μμ±ν΄ μ£ΌμΈμ" ,
|
694 |
+
"μ΄ μ½λμμ μ€λ₯λ₯Ό μμ ν΄ μ£ΌμΈμ",
|
695 |
+
"μ λ΄μ©μ μ λ¦¬ν΄ μ£ΌμΈμ",
|
696 |
+
"μ λ΄μ©μ μμ μ§λ¬Έμ λ§λ€μ΄ μ£ΌμΈμ"],
|
697 |
+
inputs=message
|
698 |
+
)
|
699 |
+
|
700 |
+
with gr.Tab("Settings"):
|
701 |
+
tools_cb_group = gr.CheckboxGroup(label="Tools:", choices=TOOLS_LIST,
|
702 |
+
value=TOOLS_DEFAULT_LIST)
|
703 |
+
tools_cb_group.change(update_selected_tools,
|
704 |
+
inputs=[tools_cb_group, tools_list_state, llm_state],
|
705 |
+
outputs=[tools_list_state, llm_state, chain_state, express_chain_state])
|
706 |
+
|
707 |
+
trace_chain_cb = gr.Checkbox(label="Show reasoning chain in chat bubble", value=False)
|
708 |
+
trace_chain_cb.change(update_foo, inputs=[trace_chain_cb, trace_chain_state],
|
709 |
+
outputs=[trace_chain_state])
|
710 |
+
|
711 |
+
# speak_text_cb = gr.Checkbox(label="Speak text from agent", value=False)
|
712 |
+
# speak_text_cb.change(update_foo, inputs=[speak_text_cb, speak_text_state],
|
713 |
+
# outputs=[speak_text_state])
|
714 |
+
|
715 |
+
talking_head_cb = gr.Checkbox(label="Show talking head", value=True)
|
716 |
+
# talking_head_cb.change(update_talking_head, inputs=[talking_head_cb, talking_head_state],
|
717 |
+
# outputs=[talking_head_state, video_html])
|
718 |
+
|
719 |
+
monologue_cb = gr.Checkbox(label="Babel fish mode (translate/restate what you enter, no conversational agent)",
|
720 |
+
value=False)
|
721 |
+
monologue_cb.change(update_foo, inputs=[monologue_cb, monologue_state],
|
722 |
+
outputs=[monologue_state])
|
723 |
+
|
724 |
+
reset_btn = gr.Button(value="Reset chat", variant="secondary").style(full_width=False)
|
725 |
+
reset_btn.click(reset_memory, inputs=[history_state, memory_state], outputs=[chatbot, history_state, memory_state])
|
726 |
+
|
727 |
+
with gr.Tab("Whisper STT"):
|
728 |
+
whisper_lang_radio = gr.Radio(label="Whisper speech-to-text language:", choices=[
|
729 |
+
WHISPER_DETECT_LANG, "Arabic", "Arabic (Gulf)", "Catalan", "Chinese (Cantonese)", "Chinese (Mandarin)",
|
730 |
+
"Danish", "Dutch", "English (Australian)", "English (British)", "English (Indian)", "English (New Zealand)",
|
731 |
+
"English (South African)", "English (US)", "English (Welsh)", "Finnish", "French", "French (Canadian)",
|
732 |
+
"German", "German (Austrian)", "Georgian", "Hindi", "Icelandic", "Indonesian", "Italian", "Japanese",
|
733 |
+
"Korean", "Norwegian", "Polish",
|
734 |
+
"Portuguese (Brazilian)", "Portuguese (European)", "Romanian", "Russian", "Spanish (European)",
|
735 |
+
"Spanish (Mexican)", "Spanish (US)", "Swedish", "Turkish", "Ukrainian", "Vietnamese", "Welsh"],
|
736 |
+
value=WHISPER_DETECT_LANG)
|
737 |
+
|
738 |
+
whisper_lang_radio.change(update_foo,
|
739 |
+
inputs=[whisper_lang_radio, whisper_lang_state],
|
740 |
+
outputs=[whisper_lang_state])
|
741 |
+
|
742 |
+
with gr.Tab("Translate to"):
|
743 |
+
lang_level_radio = gr.Radio(label="Language level:", choices=[
|
744 |
+
LANG_LEVEL_DEFAULT, "1st grade", "2nd grade", "3rd grade", "4th grade", "5th grade", "6th grade",
|
745 |
+
"7th grade", "8th grade", "9th grade", "10th grade", "11th grade", "12th grade", "University"],
|
746 |
+
value=LANG_LEVEL_DEFAULT)
|
747 |
+
lang_level_radio.change(update_foo, inputs=[lang_level_radio, lang_level_state],
|
748 |
+
outputs=[lang_level_state])
|
749 |
+
|
750 |
+
translate_to_radio = gr.Radio(label="Language:", choices=[
|
751 |
+
TRANSLATE_TO_DEFAULT, "Arabic", "Arabic (Gulf)", "Catalan", "Chinese (Cantonese)", "Chinese (Mandarin)",
|
752 |
+
"Danish", "Dutch", "English (Australian)", "English (British)", "English (Indian)", "English (New Zealand)",
|
753 |
+
"English (South African)", "English (US)", "English (Welsh)", "Finnish", "French", "French (Canadian)",
|
754 |
+
"German", "German (Austrian)", "Georgian", "Hindi", "Icelandic", "Indonesian", "Italian", "Japanese",
|
755 |
+
"Korean", "Norwegian", "Polish",
|
756 |
+
"Portuguese (Brazilian)", "Portuguese (European)", "Romanian", "Russian", "Spanish (European)",
|
757 |
+
"Spanish (Mexican)", "Spanish (US)", "Swedish", "Turkish", "Ukrainian", "Vietnamese", "Welsh",
|
758 |
+
"emojis", "Gen Z slang", "how the stereotypical Karen would say it", "Klingon", "Neanderthal",
|
759 |
+
"Pirate", "Strange Planet expospeak technical talk", "Yoda"],
|
760 |
+
value=TRANSLATE_TO_DEFAULT)
|
761 |
+
|
762 |
+
translate_to_radio.change(update_foo,
|
763 |
+
inputs=[translate_to_radio, translate_to_state],
|
764 |
+
outputs=[translate_to_state])
|
765 |
+
|
766 |
+
with gr.Tab("Formality"):
|
767 |
+
formality_radio = gr.Radio(label="Formality:",
|
768 |
+
choices=[FORMALITY_DEFAULT, "Casual", "Polite", "Honorific"],
|
769 |
+
value=FORMALITY_DEFAULT)
|
770 |
+
formality_radio.change(update_foo,
|
771 |
+
inputs=[formality_radio, formality_state],
|
772 |
+
outputs=[formality_state])
|
773 |
+
|
774 |
+
with gr.Tab("Lit style"):
|
775 |
+
literary_style_radio = gr.Radio(label="Literary style:", choices=[
|
776 |
+
LITERARY_STYLE_DEFAULT, "Prose", "Story", "Summary", "Outline", "Bullets", "Poetry", "Haiku", "Limerick", "Rap",
|
777 |
+
"Joke", "Knock-knock", "FAQ"],
|
778 |
+
value=LITERARY_STYLE_DEFAULT)
|
779 |
+
|
780 |
+
literary_style_radio.change(update_foo,
|
781 |
+
inputs=[literary_style_radio, literary_style_state],
|
782 |
+
outputs=[literary_style_state])
|
783 |
+
|
784 |
+
with gr.Tab("Emotions"):
|
785 |
+
anticipation_level_radio = gr.Radio(label="Anticipation level:",
|
786 |
+
choices=[EMOTION_DEFAULT, "Interest", "Anticipation", "Vigilance"],
|
787 |
+
value=EMOTION_DEFAULT)
|
788 |
+
anticipation_level_radio.change(update_foo,
|
789 |
+
inputs=[anticipation_level_radio, anticipation_level_state],
|
790 |
+
outputs=[anticipation_level_state])
|
791 |
+
|
792 |
+
joy_level_radio = gr.Radio(label="Joy level:",
|
793 |
+
choices=[EMOTION_DEFAULT, "Serenity", "Joy", "Ecstasy"],
|
794 |
+
value=EMOTION_DEFAULT)
|
795 |
+
joy_level_radio.change(update_foo,
|
796 |
+
inputs=[joy_level_radio, joy_level_state],
|
797 |
+
outputs=[joy_level_state])
|
798 |
+
|
799 |
+
trust_level_radio = gr.Radio(label="Trust level:",
|
800 |
+
choices=[EMOTION_DEFAULT, "Acceptance", "Trust", "Admiration"],
|
801 |
+
value=EMOTION_DEFAULT)
|
802 |
+
trust_level_radio.change(update_foo,
|
803 |
+
inputs=[trust_level_radio, trust_level_state],
|
804 |
+
outputs=[trust_level_state])
|
805 |
+
|
806 |
+
fear_level_radio = gr.Radio(label="Fear level:",
|
807 |
+
choices=[EMOTION_DEFAULT, "Apprehension", "Fear", "Terror"],
|
808 |
+
value=EMOTION_DEFAULT)
|
809 |
+
fear_level_radio.change(update_foo,
|
810 |
+
inputs=[fear_level_radio, fear_level_state],
|
811 |
+
outputs=[fear_level_state])
|
812 |
+
|
813 |
+
surprise_level_radio = gr.Radio(label="Surprise level:",
|
814 |
+
choices=[EMOTION_DEFAULT, "Distraction", "Surprise", "Amazement"],
|
815 |
+
value=EMOTION_DEFAULT)
|
816 |
+
surprise_level_radio.change(update_foo,
|
817 |
+
inputs=[surprise_level_radio, surprise_level_state],
|
818 |
+
outputs=[surprise_level_state])
|
819 |
+
|
820 |
+
sadness_level_radio = gr.Radio(label="Sadness level:",
|
821 |
+
choices=[EMOTION_DEFAULT, "Pensiveness", "Sadness", "Grief"],
|
822 |
+
value=EMOTION_DEFAULT)
|
823 |
+
sadness_level_radio.change(update_foo,
|
824 |
+
inputs=[sadness_level_radio, sadness_level_state],
|
825 |
+
outputs=[sadness_level_state])
|
826 |
+
|
827 |
+
disgust_level_radio = gr.Radio(label="Disgust level:",
|
828 |
+
choices=[EMOTION_DEFAULT, "Boredom", "Disgust", "Loathing"],
|
829 |
+
value=EMOTION_DEFAULT)
|
830 |
+
disgust_level_radio.change(update_foo,
|
831 |
+
inputs=[disgust_level_radio, disgust_level_state],
|
832 |
+
outputs=[disgust_level_state])
|
833 |
+
|
834 |
+
anger_level_radio = gr.Radio(label="Anger level:",
|
835 |
+
choices=[EMOTION_DEFAULT, "Annoyance", "Anger", "Rage"],
|
836 |
+
value=EMOTION_DEFAULT)
|
837 |
+
anger_level_radio.change(update_foo,
|
838 |
+
inputs=[anger_level_radio, anger_level_state],
|
839 |
+
outputs=[anger_level_state])
|
840 |
+
|
841 |
+
with gr.Tab("Max words"):
|
842 |
+
num_words_slider = gr.Slider(label="Max number of words to generate (0 for don't care)",
|
843 |
+
value=NUM_WORDS_DEFAULT, minimum=0, maximum=MAX_WORDS, step=10)
|
844 |
+
num_words_slider.change(update_foo,
|
845 |
+
inputs=[num_words_slider, num_words_state],
|
846 |
+
outputs=[num_words_state])
|
847 |
+
|
848 |
+
with gr.Tab("Embeddings"):
|
849 |
+
embeddings_text_box = gr.Textbox(label="Enter text for embeddings and hit Create:",
|
850 |
+
lines=20)
|
851 |
+
|
852 |
+
with gr.Row():
|
853 |
+
use_embeddings_cb = gr.Checkbox(label="Use embeddings", value=False)
|
854 |
+
use_embeddings_cb.change(update_use_embeddings, inputs=[use_embeddings_cb, use_embeddings_state],
|
855 |
+
outputs=[use_embeddings_state])
|
856 |
+
|
857 |
+
embeddings_text_submit = gr.Button(value="Create", variant="secondary").style(full_width=False)
|
858 |
+
embeddings_text_submit.click(update_embeddings,
|
859 |
+
inputs=[embeddings_text_box, embeddings_state, qa_chain_state],
|
860 |
+
outputs=[docsearch_state])
|
861 |
+
|
862 |
+
gr.HTML("""
|
863 |
+
<p>OpenAI GPT-3.5μ LangChainμ μ¬μ©νμ¬ μ±ν
νμμΌλ‘ 보μ¬μ€λλ€.</a>
|
864 |
+
μ½λ μμ±μ μμ², μ€λ₯ μμ , SQLνλ, λ²μ(ννκ³ λ μ΄μ μλ
~)μ μμμΌλ‘
|
865 |
+
<b>KBκΈμ΅ μ λ¬Έκ°λ‘μ νλ¨λλ Data Importμ Modellingλ₯Ό μ€νμμ€λ‘ μ€νν΄ λ³΄μΈμ.</b>
|
866 |
+
</p>""")
|
867 |
+
|
868 |
+
|
869 |
+
gr.HTML("""
|
870 |
+
<p>μ΄ μ΄ν리μΌμ΄μ
μ<a href='https://www.linkedin.com/in/javafxpert/'>James L. Weaver</a>
|
871 |
+
λμ μ€νμμ€λ₯Ό νμ©νμμ΅λλ€. (μμμ λͺ
μ)
|
872 |
+
</p>""")
|
873 |
+
|
874 |
+
|
875 |
+
# gr.HTML("""
|
876 |
+
# <form action="https://www.paypal.com/donate" method="post" target="_blank">
|
877 |
+
# <input type="hidden" name="business" value="AK8BVNALBXSPQ" />
|
878 |
+
# <input type="hidden" name="no_recurring" value="0" />
|
879 |
+
# <input type="hidden" name="item_name" value="Please consider helping to defray the cost of APIs such as SerpAPI and WolframAlpha that this app uses." />
|
880 |
+
# <input type="hidden" name="currency_code" value="USD" />
|
881 |
+
# <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
|
882 |
+
# <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
|
883 |
+
# </form># The OpenAI API key is stored in the browser's local storage and retrieved when the application is loaded.
|
884 |
+
# # This is done using the change() and load() methods of the openai_api_key_textbox object.
|
885 |
+
|
886 |
+
# # When the user inputs the OpenAI API key, it is saved to the local storage:
|
887 |
+
# openai_api_key_textbox.change(None,
|
888 |
+
# inputs=[openai_api_key_textbox],
|
889 |
+
# outputs=None, _js="(api_key) => localStorage.setItem('open_api_key', api_key)")
|
890 |
+
|
891 |
+
# # When the application is loaded, the OpenAI API key is retrieved from the local storage and set to the openai_api_key_textbox:
|
892 |
+
# block.load(None, inputs=None, outputs=openai_api_key_textbox, _js="()=> localStorage.getItem('open_api_key')")
|
893 |
+
|
894 |
+
# # The OpenAI API key is then used to set the API key for various components in the application:
|
895 |
+
# openai_api_key_textbox.change(set_openai_api_key,
|
896 |
+
# inputs=[openai_api_key_textbox],
|
897 |
+
# outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
|
898 |
+
# qa_chain_state, memory_state])
|
899 |
+
|
900 |
+
# # The algorithmic timeline for using the OpenAI API key is as follows:
|
901 |
+
# # 1. The user inputs the OpenAI API key, which is saved to the local storage.
|
902 |
+
# # 2. The application retrieves the OpenAI API key from the local storage when it is loaded.
|
903 |
+
# # 3. The OpenAI API key is used to set the API key for various components in the application.
|
904 |
+
# # 4. The application can now use the OpenAI API key to make requests to the OpenAI API.
|
905 |
+
|
906 |
+
# """)
|
907 |
+
|
908 |
+
# gr.HTML("""<center>
|
909 |
+
# <a href="https://huggingface.co/spaces/JavaFXpert/Chat-GPT-LangChain?duplicate=true">
|
910 |
+
# <img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
911 |
+
# Powered by <a href='https://github.com/hwchase17/langchain'>LangChain π¦οΈπ</a>
|
912 |
+
# </center>""")
|
913 |
+
|
914 |
+
message.submit(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
|
915 |
+
speak_text_state, talking_head_state, monologue_state,
|
916 |
+
express_chain_state, num_words_state, formality_state,
|
917 |
+
anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
|
918 |
+
surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
|
919 |
+
lang_level_state, translate_to_state, literary_style_state,
|
920 |
+
qa_chain_state, docsearch_state, use_embeddings_state],
|
921 |
+
outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
922 |
+
# outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
|
923 |
+
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
924 |
+
|
925 |
+
submit.click(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
|
926 |
+
speak_text_state, talking_head_state, monologue_state,
|
927 |
+
express_chain_state, num_words_state, formality_state,
|
928 |
+
anticipation_level_state, joy_level_state, trust_level_state, fear_level_state,
|
929 |
+
surprise_level_state, sadness_level_state, disgust_level_state, anger_level_state,
|
930 |
+
lang_level_state, translate_to_state, literary_style_state,
|
931 |
+
qa_chain_state, docsearch_state, use_embeddings_state],
|
932 |
+
outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
933 |
+
# outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
|
934 |
+
|
935 |
+
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
|
936 |
+
|
937 |
+
openai_api_key_textbox.change(None,
|
938 |
+
inputs=[openai_api_key_textbox],
|
939 |
+
outputs=None, _js="(api_key) => localStorage.setItem('open_api_key', api_key)")
|
940 |
+
|
941 |
+
openai_api_key_textbox.change(set_openai_api_key,
|
942 |
+
inputs=[openai_api_key_textbox],
|
943 |
+
outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
|
944 |
+
qa_chain_state, memory_state])
|
945 |
+
|
946 |
+
block.load(None, inputs=None, outputs=openai_api_key_textbox, _js="()=> localStorage.getItem('open_api_key')")
|
947 |
+
|
948 |
+
|
949 |
+
block.launch(debug=True)
|
audios/tempfile.mp3
ADDED
Binary file (785 kB). View file
|
|
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)
|
gitattributes (1).txt
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
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
|
35 |
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
images/Masahiro.png
ADDED
Git LFS Details
|
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,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
openai==0.27.4
|
2 |
+
gradio==3.24.1
|
3 |
+
google-search-results==2.4.2
|
4 |
+
google-api-python-client==2.83.0
|
5 |
+
wolframalpha
|
6 |
+
langchain==0.0.131
|
7 |
+
requests==2.28.2
|
8 |
+
git+https://github.com/openai/whisper.git
|
9 |
+
boto3==1.26.106
|
10 |
+
faiss-cpu
|
11 |
+
promptlayer
|
videos/Masahiro.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b9fd39b5c861b119b253efdfa70ac806f73ccbed199149a193ba5c0c34780fd4
|
3 |
+
size 7156098
|
videos/tempfile.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b9fd39b5c861b119b253efdfa70ac806f73ccbed199149a193ba5c0c34780fd4
|
3 |
+
size 7156098
|