Spaces:
Build error
Build error
unknown
commited on
Commit
·
48f3d89
1
Parent(s):
6fce298
update infor
Browse files
app.py
CHANGED
|
@@ -5,7 +5,9 @@ import gradio as gr
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
hugapikey=os.environ['openaikey']
|
|
|
|
| 8 |
genaikey=os.environ['genaikey']
|
|
|
|
| 9 |
#MODEL_NAME = "seiching/whisper-small-seiching"
|
| 10 |
MODEL_NAME = "openai/whisper-tiny"
|
| 11 |
BATCH_SIZE = 8
|
|
@@ -274,6 +276,8 @@ def writenotes( LLMmodel,apikeystr,prompt,inputscript):
|
|
| 274 |
#text=transcribe_text
|
| 275 |
#openaikey.set_key(inputkey)
|
| 276 |
#openaikey = OpenAIKeyClass(inputkey)
|
|
|
|
|
|
|
| 277 |
global transcribe_text
|
| 278 |
print('ok')
|
| 279 |
if len(inputscript)>10: #有資料表示不是來自語音辨識結果
|
|
@@ -299,7 +303,7 @@ def writenotes( LLMmodel,apikeystr,prompt,inputscript):
|
|
| 299 |
return ainotestext
|
| 300 |
ainotes = gr.Interface(
|
| 301 |
fn=writenotes,
|
| 302 |
-
inputs=[ gr.inputs.Radio(["gemini","gpt-3.5-turbo", "gpt-4-0125-preview"], label="LLMmodel", default="gemini"),gr.Textbox(label="使用GPT請輸入OPEN AI API KEY",placeholder="請輸入sk..."),gr.Textbox(label="
|
| 303 |
outputs="text",
|
| 304 |
layout="horizontal",
|
| 305 |
theme="huggingface",
|
|
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
hugapikey=os.environ['openaikey']
|
| 8 |
+
#hugapikey='test'
|
| 9 |
genaikey=os.environ['genaikey']
|
| 10 |
+
#genaikey='test'
|
| 11 |
#MODEL_NAME = "seiching/whisper-small-seiching"
|
| 12 |
MODEL_NAME = "openai/whisper-tiny"
|
| 13 |
BATCH_SIZE = 8
|
|
|
|
| 276 |
#text=transcribe_text
|
| 277 |
#openaikey.set_key(inputkey)
|
| 278 |
#openaikey = OpenAIKeyClass(inputkey)
|
| 279 |
+
if(len(prompt))<10:
|
| 280 |
+
prompt=DEFAULTPROMPT
|
| 281 |
global transcribe_text
|
| 282 |
print('ok')
|
| 283 |
if len(inputscript)>10: #有資料表示不是來自語音辨識結果
|
|
|
|
| 303 |
return ainotestext
|
| 304 |
ainotes = gr.Interface(
|
| 305 |
fn=writenotes,
|
| 306 |
+
inputs=[ gr.inputs.Radio(["gemini","gpt-3.5-turbo", "gpt-4-0125-preview"], label="LLMmodel", default="gemini"),gr.Textbox(label="使用GPT請輸入OPEN AI API KEY",placeholder="請輸入sk..."),gr.Textbox(label="自訂提示詞(prompt)若無會用以下預設值",info=DEFAULTPROMPT),gr.Textbox(label="逐字稿",placeholder="若沒有做語音辨識,請輸入逐字稿")],
|
| 307 |
outputs="text",
|
| 308 |
layout="horizontal",
|
| 309 |
theme="huggingface",
|