Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,6 @@ generate_kwargs = {
|
|
| 22 |
"max_new_tokens": 64,
|
| 23 |
}
|
| 24 |
|
| 25 |
-
|
| 26 |
model_dict = {
|
| 27 |
"whisper-large-v3-turbo": "openai/whisper-large-v3-turbo",
|
| 28 |
"kotoba-whisper-v2.0": "kotoba-tech/kotoba-whisper-v2.0",
|
|
@@ -71,13 +70,12 @@ def transcribe_common(audio: str, model: str) -> str:
|
|
| 71 |
logger.success(f"Finished in {end_time - start_time:.2f}s\n{result}")
|
| 72 |
|
| 73 |
# Guardar resultado en un archivo .str
|
| 74 |
-
output_path = f"{Path(filename).stem}.str"
|
| 75 |
with open(output_path, "w", encoding="utf-8") as f:
|
| 76 |
f.write(result)
|
| 77 |
|
| 78 |
logger.info(f"Transcription saved to {output_path}")
|
| 79 |
-
return
|
| 80 |
-
|
| 81 |
|
| 82 |
|
| 83 |
def transcribe_others(audio) -> tuple[str, str]:
|
|
@@ -92,7 +90,7 @@ def transcribe_anime_whisper(audio) -> str:
|
|
| 92 |
|
| 93 |
initial_md = """
|
| 94 |
# Anime-Whisper Demo
|
| 95 |
-
[**Anime Whisper**](https://huggingface.co/litagin/anime-whisper): 5千時間以上のアニメ調セリフと台本でファインチューニングされた日本語音声認識モデルのデモです。句読点や感嘆符がリズムや感情に合わせて自然に付き、NSFW
|
| 96 |
- デモでは**音声は15秒まで**しか受け付けません
|
| 97 |
- 日本語のみ対応 (Japanese only)
|
| 98 |
- 比較のために [openai/whisper-large-v3-turbo](https://huggingface.co/openai/whisper-large-v3-turbo) と [kotoba-tech/kotoba-whisper-v2.0](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0) も用意しています
|
|
@@ -115,16 +113,16 @@ with gr.Blocks() as app:
|
|
| 115 |
with gr.Column():
|
| 116 |
gr.Markdown("### Anime-Whisper")
|
| 117 |
button_galgame = gr.Button("Transcribe with Anime-Whisper")
|
| 118 |
-
output_galgame = gr.
|
| 119 |
gr.Markdown("### Comparison")
|
| 120 |
button_others = gr.Button("Transcribe with other models")
|
| 121 |
with gr.Row():
|
| 122 |
with gr.Column():
|
| 123 |
gr.Markdown("### Whisper-Large-V3-Turbo")
|
| 124 |
-
output_v3 = gr.
|
| 125 |
with gr.Column():
|
| 126 |
gr.Markdown("### Kotoba-Whisper-V2.0")
|
| 127 |
-
output_kotoba_v2 = gr.
|
| 128 |
|
| 129 |
button_galgame.click(
|
| 130 |
transcribe_anime_whisper,
|
|
@@ -138,3 +136,4 @@ with gr.Blocks() as app:
|
|
| 138 |
)
|
| 139 |
|
| 140 |
app.launch(inbrowser=True)
|
|
|
|
|
|
| 22 |
"max_new_tokens": 64,
|
| 23 |
}
|
| 24 |
|
|
|
|
| 25 |
model_dict = {
|
| 26 |
"whisper-large-v3-turbo": "openai/whisper-large-v3-turbo",
|
| 27 |
"kotoba-whisper-v2.0": "kotoba-tech/kotoba-whisper-v2.0",
|
|
|
|
| 70 |
logger.success(f"Finished in {end_time - start_time:.2f}s\n{result}")
|
| 71 |
|
| 72 |
# Guardar resultado en un archivo .str
|
| 73 |
+
output_path = f"{Path(filename).stem}_{model}.str"
|
| 74 |
with open(output_path, "w", encoding="utf-8") as f:
|
| 75 |
f.write(result)
|
| 76 |
|
| 77 |
logger.info(f"Transcription saved to {output_path}")
|
| 78 |
+
return output_path # Devuelve el path del archivo transcrito
|
|
|
|
| 79 |
|
| 80 |
|
| 81 |
def transcribe_others(audio) -> tuple[str, str]:
|
|
|
|
| 90 |
|
| 91 |
initial_md = """
|
| 92 |
# Anime-Whisper Demo
|
| 93 |
+
[**Anime Whisper**](https://huggingface.co/litagin/anime-whisper): 5千時間以上のアニメ調セリフと台本でファインチューニングされた日本語音声認識モデルのデモです。句読点や感嘆符がリズムや感情に合わせて自然に付き、NSFW含む非言語発言もうまく台本調に書き起こされます。
|
| 94 |
- デモでは**音声は15秒まで**しか受け付けません
|
| 95 |
- 日本語のみ対応 (Japanese only)
|
| 96 |
- 比較のために [openai/whisper-large-v3-turbo](https://huggingface.co/openai/whisper-large-v3-turbo) と [kotoba-tech/kotoba-whisper-v2.0](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0) も用意しています
|
|
|
|
| 113 |
with gr.Column():
|
| 114 |
gr.Markdown("### Anime-Whisper")
|
| 115 |
button_galgame = gr.Button("Transcribe with Anime-Whisper")
|
| 116 |
+
output_galgame = gr.File(label="Download Anime-Whisper Transcription")
|
| 117 |
gr.Markdown("### Comparison")
|
| 118 |
button_others = gr.Button("Transcribe with other models")
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column():
|
| 121 |
gr.Markdown("### Whisper-Large-V3-Turbo")
|
| 122 |
+
output_v3 = gr.File(label="Download Whisper-Large-V3-Turbo Transcription")
|
| 123 |
with gr.Column():
|
| 124 |
gr.Markdown("### Kotoba-Whisper-V2.0")
|
| 125 |
+
output_kotoba_v2 = gr.File(label="Download Kotoba-Whisper-V2.0 Transcription")
|
| 126 |
|
| 127 |
button_galgame.click(
|
| 128 |
transcribe_anime_whisper,
|
|
|
|
| 136 |
)
|
| 137 |
|
| 138 |
app.launch(inbrowser=True)
|
| 139 |
+
|