Fix issue
Browse files
app.py
CHANGED
|
@@ -73,7 +73,7 @@ def transcribe(aud_inp):
|
|
| 73 |
|
| 74 |
options = whisper.DecodingOptions()
|
| 75 |
# options = whisper.DecodingOptions(language="ja")
|
| 76 |
-
|
| 77 |
result = whisper.decode(WHISPER_MODEL, mel, options)
|
| 78 |
print("result.text", result.text)
|
| 79 |
result_text = ""
|
|
@@ -207,7 +207,7 @@ def set_openai_api_key(api_key):
|
|
| 207 |
"""Set the api key and return chain.
|
| 208 |
If no api_key, then None is returned.
|
| 209 |
"""
|
| 210 |
-
if api_key:
|
| 211 |
llm = OpenAI(temperature=0, openai_api_key=api_key, max_tokens=MAX_TOKENS)
|
| 212 |
chain, express_chain = load_chain(TOOLS_DEFAULT_LIST, llm)
|
| 213 |
return chain, express_chain, llm
|
|
|
|
| 73 |
|
| 74 |
options = whisper.DecodingOptions()
|
| 75 |
# options = whisper.DecodingOptions(language="ja")
|
| 76 |
+
|
| 77 |
result = whisper.decode(WHISPER_MODEL, mel, options)
|
| 78 |
print("result.text", result.text)
|
| 79 |
result_text = ""
|
|
|
|
| 207 |
"""Set the api key and return chain.
|
| 208 |
If no api_key, then None is returned.
|
| 209 |
"""
|
| 210 |
+
if api_key and api_key.startswith("sk-") and len(api_key) > 50:
|
| 211 |
llm = OpenAI(temperature=0, openai_api_key=api_key, max_tokens=MAX_TOKENS)
|
| 212 |
chain, express_chain = load_chain(TOOLS_DEFAULT_LIST, llm)
|
| 213 |
return chain, express_chain, llm
|