Spaces:
Running
Running
poemsforaphrodite
commited on
Commit
•
f7d35cb
1
Parent(s):
160e4b0
Upload openvoice_app.py with huggingface_hub
Browse files- openvoice_app.py +3 -8
openvoice_app.py
CHANGED
@@ -20,7 +20,7 @@ load_dotenv()
|
|
20 |
app = Flask(__name__)
|
21 |
|
22 |
# Setup Limiter for rate limiting and quota management based on IP address
|
23 |
-
limiter = Limiter(get_remote_address, app=app, default_limits=["
|
24 |
|
25 |
# Argument parsing
|
26 |
parser = argparse.ArgumentParser()
|
@@ -51,7 +51,7 @@ def delete_voice(api_key, voice_id):
|
|
51 |
return response.status_code, response.text
|
52 |
|
53 |
# Predict function with rate limiting based on IP address
|
54 |
-
|
55 |
def predict(prompt, style, audio_file_pth):
|
56 |
text_hint = ''
|
57 |
if len(prompt) < 2:
|
@@ -114,12 +114,7 @@ with gr.Blocks(gr.themes.Glass()) as demo:
|
|
114 |
audio_gr = gr.Audio(label="Synthesised Audio", autoplay=True)
|
115 |
ref_audio_gr = gr.Audio(label="Reference Audio Used")
|
116 |
|
117 |
-
|
118 |
-
ip = request.remote_addr
|
119 |
-
return predict(prompt, style, audio_file_pth, ip)
|
120 |
-
|
121 |
-
tts_button.click(handle_click,
|
122 |
-
[input_text_gr, style_gr, ref_gr], outputs=[out_text_gr, audio_gr, ref_audio_gr])
|
123 |
|
124 |
demo.queue()
|
125 |
demo.launch(debug=True, show_api=False, share=args.share)
|
|
|
20 |
app = Flask(__name__)
|
21 |
|
22 |
# Setup Limiter for rate limiting and quota management based on IP address
|
23 |
+
limiter = Limiter(get_remote_address, app=app, default_limits=["5 per minute"])
|
24 |
|
25 |
# Argument parsing
|
26 |
parser = argparse.ArgumentParser()
|
|
|
51 |
return response.status_code, response.text
|
52 |
|
53 |
# Predict function with rate limiting based on IP address
|
54 |
+
#@limiter.limit("100 per minute")
|
55 |
def predict(prompt, style, audio_file_pth):
|
56 |
text_hint = ''
|
57 |
if len(prompt) < 2:
|
|
|
114 |
audio_gr = gr.Audio(label="Synthesised Audio", autoplay=True)
|
115 |
ref_audio_gr = gr.Audio(label="Reference Audio Used")
|
116 |
|
117 |
+
tts_button.click(predict, [input_text_gr, style_gr, ref_gr], outputs=[out_text_gr, audio_gr, ref_audio_gr])
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
demo.queue()
|
120 |
demo.launch(debug=True, show_api=False, share=args.share)
|