Nymbo commited on
Commit
29b4482
·
1 Parent(s): 708c89d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import gradio as gr
2
  import os
3
  import tempfile
 
4
  from openai import OpenAI
5
 
6
-
7
  def tts(text, model, voice, api_key):
8
  if api_key == '':
9
  raise gr.Error('Please enter your OpenAI API Key')
@@ -32,7 +32,7 @@ def tts(text, model, voice, api_key):
32
  return temp_file_path
33
 
34
 
35
- with gr.Blocks() as demo:
36
  #gr.Markdown("# <center> Alyxsissy TTS Preview </center>")
37
  #gr.HTML("You can also access the Streaming demo for OpenAI TTS by clicking this <a href='https://huggingface.co/spaces/ysharma/OpenAI_TTS_Streaming'>Gradio demo link</a>")
38
  with gr.Row(variant='panel'):
@@ -41,7 +41,7 @@ with gr.Blocks() as demo:
41
  voice = gr.Dropdown(choices=['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'], label='Voice', value='nova')
42
 
43
  text = gr.Textbox(label="Input Text", placeholder="Enter your text and then click on the button below.")
44
- btn = gr.Button("Run")
45
  output_audio = gr.Audio(label="Speech Output")
46
 
47
  text.submit(fn=tts, inputs=[text, model, voice, api_key], outputs=output_audio, api_name="tts_enter_key", concurrency_limit=None)
 
1
  import gradio as gr
2
  import os
3
  import tempfile
4
+ import time
5
  from openai import OpenAI
6
 
 
7
  def tts(text, model, voice, api_key):
8
  if api_key == '':
9
  raise gr.Error('Please enter your OpenAI API Key')
 
32
  return temp_file_path
33
 
34
 
35
+ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="pink")) as demo:
36
  #gr.Markdown("# <center> Alyxsissy TTS Preview </center>")
37
  #gr.HTML("You can also access the Streaming demo for OpenAI TTS by clicking this <a href='https://huggingface.co/spaces/ysharma/OpenAI_TTS_Streaming'>Gradio demo link</a>")
38
  with gr.Row(variant='panel'):
 
41
  voice = gr.Dropdown(choices=['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'], label='Voice', value='nova')
42
 
43
  text = gr.Textbox(label="Input Text", placeholder="Enter your text and then click on the button below.")
44
+ btn = gr.Button("Run", variant="primary")
45
  output_audio = gr.Audio(label="Speech Output")
46
 
47
  text.submit(fn=tts, inputs=[text, model, voice, api_key], outputs=output_audio, api_name="tts_enter_key", concurrency_limit=None)