Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import tempfile
|
| 2 |
-
|
| 3 |
from pathlib import Path
|
| 4 |
|
| 5 |
import gradio as gr
|
|
@@ -26,7 +25,7 @@ def generate_audio(text, audio_prompt):
|
|
| 26 |
if audio_prompt is not None:
|
| 27 |
sr, audio = audio_prompt
|
| 28 |
|
| 29 |
-
if audio is not None and
|
| 30 |
with tempfile.NamedTemporaryFile(mode="wb", suffix=".wav", delete=False) as f:
|
| 31 |
sf.write(f.name, audio, sr)
|
| 32 |
prompt_path = f.name
|
|
@@ -34,10 +33,9 @@ def generate_audio(text, audio_prompt):
|
|
| 34 |
audio_out = model.generate(
|
| 35 |
text=text,
|
| 36 |
audio_prompt=prompt_path,
|
| 37 |
-
max_tokens=None,
|
| 38 |
cfg_scale=3.0,
|
| 39 |
-
temperature=1.
|
| 40 |
-
top_p=0.
|
| 41 |
)
|
| 42 |
|
| 43 |
if prompt_path is not None and Path(prompt_path).exists():
|
|
|
|
| 1 |
import tempfile
|
|
|
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
import gradio as gr
|
|
|
|
| 25 |
if audio_prompt is not None:
|
| 26 |
sr, audio = audio_prompt
|
| 27 |
|
| 28 |
+
if audio is not None and np.size(audio) > 0:
|
| 29 |
with tempfile.NamedTemporaryFile(mode="wb", suffix=".wav", delete=False) as f:
|
| 30 |
sf.write(f.name, audio, sr)
|
| 31 |
prompt_path = f.name
|
|
|
|
| 33 |
audio_out = model.generate(
|
| 34 |
text=text,
|
| 35 |
audio_prompt=prompt_path,
|
|
|
|
| 36 |
cfg_scale=3.0,
|
| 37 |
+
temperature=1.2,
|
| 38 |
+
top_p=0.9,
|
| 39 |
)
|
| 40 |
|
| 41 |
if prompt_path is not None and Path(prompt_path).exists():
|