import gradio as gr import os import csv import numpy as np import scipy.io.wavfile as wavfile css = """ .gradio-container input::placeholder, .gradio-container textarea::placeholder { color: #333333 !important; } code { background-color: #ffde9f; padding: 2px 4px; border-radius: 3px; } #settings-accordion summary { justify-content: center; } .examples-holder > .label { color: #b45309 !important; font-weight: 600; } """ def load_examples(csv_path): examples = [] if not os.path.exists(csv_path): print(f"Warning: Examples file not found at {csv_path}") return examples try: with open(csv_path, 'r', encoding='utf-8') as f: reader = csv.reader(f, delimiter='|') for row in reader: if len(row) >= 2: text = row[0].strip() audio_path = row[1].strip() # Handle temperature (third column) temperature = 0.7 # Default temperature if len(row) >= 3: try: temp_str = row[2].strip() if temp_str and temp_str.lower() != 'none': temperature = float(temp_str) # Clamp temperature to valid range temperature = max(0.0, min(1.3, temperature)) except (ValueError, TypeError): print(f"Warning: Invalid temperature value '{row[2]}', using default 0.7") temperature = 0.7 # Handle chained longform (fourth column) use_chained = False # Default to False if len(row) >= 4: chained_str = row[3].strip().lower() if chained_str in ['true', '1', 'yes', 'on']: use_chained = True elif chained_str in ['false', '0', 'no', 'off', 'none', '']: use_chained = False else: print(f"Warning: Invalid chained longform value '{row[3]}', using default False") use_chained = False # Handle pre-generated audio path (fifth column) pregenerated_audio = None if len(row) >= 5: pregenerated_path = row[4].strip() if pregenerated_path and pregenerated_path.lower() != "none": if not os.path.isabs(pregenerated_path): base_dir = os.path.dirname(csv_path) pregenerated_path = os.path.join(base_dir, pregenerated_path) if os.path.exists(pregenerated_path): pregenerated_audio = pregenerated_path print(f"Found pre-generated audio: {pregenerated_path}") else: print(f"Warning: Pre-generated audio file not found: {pregenerated_path}") if audio_path.lower() == "none": audio_path = None elif audio_path and not os.path.isabs(audio_path): base_dir = os.path.dirname(csv_path) audio_path = os.path.join(base_dir, audio_path) if not os.path.exists(audio_path): print(f"Warning: Audio file not found: {audio_path}") audio_path = None examples.append([text, audio_path, temperature, use_chained, pregenerated_audio]) print(f"Added example {len(examples)}: text={text[:30]}..., pregenerated={pregenerated_audio}") except Exception as e: print(f"Error loading examples: {e}") return examples def run_generation_pipeline_client(*args): # Demo is closed - return error message return None, "Status: デモは終了しました。生成例をご覧ください。/ Demo has been closed. Please check the pre-generated examples." # Load examples examples_csv_path = "./samples.csv" # Adjust path as needed for client side example_list = load_examples(examples_csv_path) # Prepare examples for gr.Examples - only first 4 columns for input example_inputs = [ex[:4] for ex in example_list] # Create Gradio interface with gr.Blocks(theme="Respair/Shiki@9.1.0", css=css) as demo: gr.Markdown('
この短い間に、多くの方に『高音』を試してくださり、大変光栄に思います!
残念ながらこのデモは、数万人が利用するような実際の製品ではなく、あくまで技術的に何が可能かを示すためのものです。サーバーへの大きな負担、そして声優の方々への潜在的な悪用(話者IDがマッピングされているらしい?)を防ぐため、今はデモを停止することにしました。
Read Meタブでも記載した通り、モデル自体を公開したり、倫理的な理由によりAPIを販売する予定もありません。ただし、日本でこの分野を前進させるために、必要な支援やパートナーを見つけられればと願っています。音声合成に限らず、私が本当に楽しんでいる分野ですので、もしどなたかご存知でしたら、ぜひお声がけください!
ご理解いただき、ありがとうございます。楽しんでいただけていれば幸いです。
もし私の活動や音声・ASR etc. などと言うフィールドにご興味があれば、今後もまた何か楽しいことをするかもしれませんので、Twitter | Xでフォローしていただけると嬉しいです!
デモをテストできなかった方は、ぜひExamplesタブで生成済みの例をご覧ください。(サンプル自体をクリックすると、事前に生成された例がメインタブに読み込まれます。)
🌸 Well boys, party is over!
Takane is a frontier Japanese-only speech synthesis network that was trained on tens of thousands of high quality data to autoregressively generate highly compressed audio codes. This network is powered by Kanadec, the world's only 44.1 kHz - 25 frame rate speech tokenizer which utilizes semantic and acoustic distillation to generate audio tokens as fast as possible.
There are two checkpoints in this demo, one of them utilizes a custom version of Rope to manipulate duration which is seldom seen in autoregressive settings. Please treat it as a proof of concept as its outputs are not very reliable. I'll include it to show that it can work to some levels and can be expanded upon. Both checkpoints have been fine-tuned on a subset of the dataset with only speaker tags. This will allow us to generate high quality samples without relying on audio prompts or dealing with random speaker attributes, but at the cost of tanking the zero-shot faithfulness of the model.
Takane also comes with an Anti-Hallucination Algorithm (AHA) that generates a few candidates in parallel and automatically returns the best one at the cost of introducing a small overhead. If you need the fastest response time possible, feel free to enable the Turbo mode. It will disable AHA and tweak the parameters internally to produce samples as fast as 2-3 seconds (though due to an influx of users coming in, you probably will be qeued and have to wait!)
There's no plan to release this model or even monetize it. this is just a tech demo, therefore I am not accountable for what users may generate.
If you're not using an audio prompt or a speaker tag, or even if you do, you find the later sentences to be too different, then in that case you may want to enable the Chained mode, which will sequentially condition each output to ensure speaker consistency.
🌸 Takane - Advanced Japanese Text-to-Speech System