Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
3 |
-
from bark.
|
|
|
4 |
from scipy.io.wavfile import write as write_wav
|
5 |
import tempfile
|
6 |
import librosa
|
@@ -41,8 +42,8 @@ def preprocess_audio_to_npz(audio_path):
|
|
41 |
audio = audio.astype(np.float32)
|
42 |
|
43 |
with torch.device("cpu"):
|
44 |
-
# Generate semantic
|
45 |
-
#
|
46 |
dummy_text = "Dummy text for history prompt generation."
|
47 |
semantic_tokens = text_to_semantic(dummy_text, temp=0.7, silent=True)
|
48 |
|
@@ -54,11 +55,11 @@ def preprocess_audio_to_npz(audio_path):
|
|
54 |
silent=True
|
55 |
)
|
56 |
|
57 |
-
# Create history prompt dictionary
|
58 |
history_prompt = {
|
59 |
"semantic_prompt": semantic_tokens,
|
60 |
"coarse_prompt": coarse_tokens,
|
61 |
-
"fine_prompt": coarse_tokens # Fine prompt
|
62 |
}
|
63 |
|
64 |
# Save to temporary .npz file
|
|
|
1 |
import gradio as gr
|
2 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
3 |
+
from bark.api import text_to_semantic
|
4 |
+
from bark.generation import generate_text_semantic
|
5 |
from scipy.io.wavfile import write as write_wav
|
6 |
import tempfile
|
7 |
import librosa
|
|
|
42 |
audio = audio.astype(np.float32)
|
43 |
|
44 |
with torch.device("cpu"):
|
45 |
+
# Generate dummy semantic and coarse tokens
|
46 |
+
# Since HuBERT is not implemented, use text_to_semantic with dummy text
|
47 |
dummy_text = "Dummy text for history prompt generation."
|
48 |
semantic_tokens = text_to_semantic(dummy_text, temp=0.7, silent=True)
|
49 |
|
|
|
55 |
silent=True
|
56 |
)
|
57 |
|
58 |
+
# Create history prompt dictionary with minimal structure
|
59 |
history_prompt = {
|
60 |
"semantic_prompt": semantic_tokens,
|
61 |
"coarse_prompt": coarse_tokens,
|
62 |
+
"fine_prompt": coarse_tokens # Fine prompt often mirrors coarse in Bark
|
63 |
}
|
64 |
|
65 |
# Save to temporary .npz file
|