Spaces:
Runtime error
Runtime error
Commit
·
4e05621
1
Parent(s):
26d6d8d
fix auth
Browse files
app.ipynb
CHANGED
@@ -252,7 +252,7 @@
|
|
252 |
"outputs": [],
|
253 |
"source": [
|
254 |
"#| export\n",
|
255 |
-
"def create_speech2(input_text, model='tts-1', voice='alloy',
|
256 |
" assert authorized(profile) is not None,'Unauthorized M'\n",
|
257 |
" start = datetime.now()\n",
|
258 |
" # Split the input text into chunks\n",
|
@@ -294,7 +294,7 @@
|
|
294 |
"outputs": [],
|
295 |
"source": [
|
296 |
"#| export\n",
|
297 |
-
"def create_speech(input_text, model='tts-1', voice='alloy',
|
298 |
" assert authorized(profile) is not None,'Unauthorized M'\n",
|
299 |
" # Split the input text into chunks\n",
|
300 |
" chunks = split_text(input_text)\n",
|
@@ -414,7 +414,7 @@
|
|
414 |
" input_text.input(fn=get_generation_cost, inputs=[input_text,tts_model_dropdown], outputs=generation_cost)\n",
|
415 |
" tts_model_dropdown.input(fn=get_generation_cost, inputs=[input_text,tts_model_dropdown], outputs=generation_cost)\n",
|
416 |
" go_btn = gr.Button(\"Go\")\n",
|
417 |
-
" go_btn.click(fn=create_speech2, inputs=[input_text, tts_model_dropdown, tts_voice_dropdown], outputs=[output_audio])\n",
|
418 |
" clear_btn = gr.Button('Clear')\n",
|
419 |
" clear_btn.click(fn=lambda: '', outputs=input_text)\n",
|
420 |
"\n",
|
@@ -489,7 +489,7 @@
|
|
489 |
},
|
490 |
{
|
491 |
"cell_type": "code",
|
492 |
-
"execution_count":
|
493 |
"id": "0420310d-930b-4904-8bd4-3458ad8bdbd3",
|
494 |
"metadata": {},
|
495 |
"outputs": [],
|
|
|
252 |
"outputs": [],
|
253 |
"source": [
|
254 |
"#| export\n",
|
255 |
+
"def create_speech2(input_text, profile: gr.OAuthProfile|None, model='tts-1', voice='alloy', progress=gr.Progress(), **kwargs):\n",
|
256 |
" assert authorized(profile) is not None,'Unauthorized M'\n",
|
257 |
" start = datetime.now()\n",
|
258 |
" # Split the input text into chunks\n",
|
|
|
294 |
"outputs": [],
|
295 |
"source": [
|
296 |
"#| export\n",
|
297 |
+
"def create_speech(input_text, profile: gr.OAuthProfile|None, model='tts-1', voice='alloy', progress=gr.Progress()):\n",
|
298 |
" assert authorized(profile) is not None,'Unauthorized M'\n",
|
299 |
" # Split the input text into chunks\n",
|
300 |
" chunks = split_text(input_text)\n",
|
|
|
414 |
" input_text.input(fn=get_generation_cost, inputs=[input_text,tts_model_dropdown], outputs=generation_cost)\n",
|
415 |
" tts_model_dropdown.input(fn=get_generation_cost, inputs=[input_text,tts_model_dropdown], outputs=generation_cost)\n",
|
416 |
" go_btn = gr.Button(\"Go\")\n",
|
417 |
+
" go_btn.click(fn=create_speech2, inputs=[input_text, None, tts_model_dropdown, tts_voice_dropdown], outputs=[output_audio])\n",
|
418 |
" clear_btn = gr.Button('Clear')\n",
|
419 |
" clear_btn.click(fn=lambda: '', outputs=input_text)\n",
|
420 |
"\n",
|
|
|
489 |
},
|
490 |
{
|
491 |
"cell_type": "code",
|
492 |
+
"execution_count": 34,
|
493 |
"id": "0420310d-930b-4904-8bd4-3458ad8bdbd3",
|
494 |
"metadata": {},
|
495 |
"outputs": [],
|
app.py
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
# %% auto 0
|
4 |
__all__ = ['secret_import_failed', 'tts_voices', 'clean_text_prompt', 'OPENAI_CLIENT_TTS_THREADS', 'launch_kwargs',
|
5 |
-
'queue_kwargs', 'split_text', 'concatenate_mp3', 'create_speech_openai', '
|
6 |
-
'get_generation_cost', 'authorized']
|
7 |
|
8 |
# %% app.ipynb 1
|
9 |
#tts_openai_secrets.py content:
|
@@ -138,7 +138,7 @@ def create_speech_openai(chunk_idx, input, model='tts-1', voice='alloy', speed=1
|
|
138 |
return chunk_idx, response.content
|
139 |
|
140 |
# %% app.ipynb 11
|
141 |
-
def create_speech2(input_text, model='tts-1', voice='alloy',
|
142 |
assert authorized(profile) is not None,'Unauthorized M'
|
143 |
start = datetime.now()
|
144 |
# Split the input text into chunks
|
@@ -173,7 +173,7 @@ def create_speech2(input_text, model='tts-1', voice='alloy', profile: gr.OAuthPr
|
|
173 |
|
174 |
|
175 |
# %% app.ipynb 12
|
176 |
-
def create_speech(input_text, model='tts-1', voice='alloy',
|
177 |
assert authorized(profile) is not None,'Unauthorized M'
|
178 |
# Split the input text into chunks
|
179 |
chunks = split_text(input_text)
|
@@ -253,7 +253,7 @@ For requests longer than 4,000 chars they will be broken into chunks of 4,000 or
|
|
253 |
input_text.input(fn=get_generation_cost, inputs=[input_text,tts_model_dropdown], outputs=generation_cost)
|
254 |
tts_model_dropdown.input(fn=get_generation_cost, inputs=[input_text,tts_model_dropdown], outputs=generation_cost)
|
255 |
go_btn = gr.Button("Go")
|
256 |
-
go_btn.click(fn=create_speech2, inputs=[input_text, tts_model_dropdown, tts_voice_dropdown], outputs=[output_audio])
|
257 |
clear_btn = gr.Button('Clear')
|
258 |
clear_btn.click(fn=lambda: '', outputs=input_text)
|
259 |
|
|
|
2 |
|
3 |
# %% auto 0
|
4 |
__all__ = ['secret_import_failed', 'tts_voices', 'clean_text_prompt', 'OPENAI_CLIENT_TTS_THREADS', 'launch_kwargs',
|
5 |
+
'queue_kwargs', 'split_text', 'concatenate_mp3', 'create_speech_openai', 'create_speech2', 'create_speech',
|
6 |
+
'get_input_text_len', 'get_generation_cost', 'authorized']
|
7 |
|
8 |
# %% app.ipynb 1
|
9 |
#tts_openai_secrets.py content:
|
|
|
138 |
return chunk_idx, response.content
|
139 |
|
140 |
# %% app.ipynb 11
|
141 |
+
def create_speech2(input_text, profile: gr.OAuthProfile|None, model='tts-1', voice='alloy', progress=gr.Progress(), **kwargs):
|
142 |
assert authorized(profile) is not None,'Unauthorized M'
|
143 |
start = datetime.now()
|
144 |
# Split the input text into chunks
|
|
|
173 |
|
174 |
|
175 |
# %% app.ipynb 12
|
176 |
+
def create_speech(input_text, profile: gr.OAuthProfile|None, model='tts-1', voice='alloy', progress=gr.Progress()):
|
177 |
assert authorized(profile) is not None,'Unauthorized M'
|
178 |
# Split the input text into chunks
|
179 |
chunks = split_text(input_text)
|
|
|
253 |
input_text.input(fn=get_generation_cost, inputs=[input_text,tts_model_dropdown], outputs=generation_cost)
|
254 |
tts_model_dropdown.input(fn=get_generation_cost, inputs=[input_text,tts_model_dropdown], outputs=generation_cost)
|
255 |
go_btn = gr.Button("Go")
|
256 |
+
go_btn.click(fn=create_speech2, inputs=[input_text, None, tts_model_dropdown, tts_voice_dropdown], outputs=[output_audio])
|
257 |
clear_btn = gr.Button('Clear')
|
258 |
clear_btn.click(fn=lambda: '', outputs=input_text)
|
259 |
|