Spaces:
Runtime error
Runtime error
Commit
·
6cc7dd6
1
Parent(s):
4e05621
fix auth
Browse files
app.ipynb
CHANGED
@@ -252,7 +252,7 @@
|
|
252 |
"outputs": [],
|
253 |
"source": [
|
254 |
"#| export\n",
|
255 |
-
"def create_speech2(input_text,
|
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,
|
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",
|
@@ -374,7 +374,7 @@
|
|
374 |
"outputs": [],
|
375 |
"source": [
|
376 |
"#| export\n",
|
377 |
-
"def authorized(profile: gr.OAuthProfile) -> str:\n",
|
378 |
" print(profile)\n",
|
379 |
" if profile in [\"matdmiller\"]:\n",
|
380 |
" return f\"{profile.username}\"\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,
|
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, model='tts-1', voice='alloy', profile: gr.OAuthProfile|None=None, 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, model='tts-1', voice='alloy', profile: gr.OAuthProfile|None=None, 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",
|
|
|
374 |
"outputs": [],
|
375 |
"source": [
|
376 |
"#| export\n",
|
377 |
+
"def authorized(profile: gr.OAuthProfile=None) -> str:\n",
|
378 |
" print(profile)\n",
|
379 |
" if profile in [\"matdmiller\"]:\n",
|
380 |
" return f\"{profile.username}\"\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, 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": 35,
|
493 |
"id": "0420310d-930b-4904-8bd4-3458ad8bdbd3",
|
494 |
"metadata": {},
|
495 |
"outputs": [],
|
app.py
CHANGED
@@ -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,
|
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, profile: gr.OAuthProfile|None, model='tts-1', voi
|
|
173 |
|
174 |
|
175 |
# %% app.ipynb 12
|
176 |
-
def create_speech(input_text,
|
177 |
assert authorized(profile) is not None,'Unauthorized M'
|
178 |
# Split the input text into chunks
|
179 |
chunks = split_text(input_text)
|
@@ -230,7 +230,7 @@ def get_generation_cost(input_text, tts_model_dropdown):
|
|
230 |
return "${:,.3f}".format(cost)
|
231 |
|
232 |
# %% app.ipynb 15
|
233 |
-
def authorized(profile: gr.OAuthProfile) -> str:
|
234 |
print(profile)
|
235 |
if profile in ["matdmiller"]:
|
236 |
return f"{profile.username}"
|
@@ -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,
|
257 |
clear_btn = gr.Button('Clear')
|
258 |
clear_btn.click(fn=lambda: '', outputs=input_text)
|
259 |
|
|
|
138 |
return chunk_idx, response.content
|
139 |
|
140 |
# %% app.ipynb 11
|
141 |
+
def create_speech2(input_text, model='tts-1', voice='alloy', profile: gr.OAuthProfile|None=None, 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, model='tts-1', voice='alloy', profile: gr.OAuthProfile|None=None, 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)
|
|
|
230 |
return "${:,.3f}".format(cost)
|
231 |
|
232 |
# %% app.ipynb 15
|
233 |
+
def authorized(profile: gr.OAuthProfile=None) -> str:
|
234 |
print(profile)
|
235 |
if profile in ["matdmiller"]:
|
236 |
return f"{profile.username}"
|
|
|
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 |
|