Spaces:
Running
on
Zero
Running
on
Zero
File size: 33,748 Bytes
ef96930 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 |
# Copyright 2025 Xiaomi Corporation.
import gradio as gr
import torch
import os
import tempfile
import argparse
from pathlib import Path
from src.mimo_audio.mimo_audio import MimoAudio
class TTSGenerator:
def __init__(self, model, device=None):
self.model = model
self.device = device
def generate(self, text, instruct, output_audio_path):
path = Path(output_audio_path)
path.parent.mkdir(parents=True, exist_ok=True)
text_output = self.model.tts_sft(text, output_audio_path, instruct)
return text_output
class AudioUnderstandingGenerator:
def __init__(self, model, device=None):
self.model = model
self.device = device
def generate(self, input_speech, input_text, thinking=False):
text = self.model.audio_understanding_sft(input_speech, input_text, thinking=thinking)
return text
class SpokenDialogueGenerator:
def __init__(self, model, device=None):
self.model = model
self.device = device
def generate(self, input_speech, output_audio_path, system_prompt="You are MiMo-Audio, a friendly AI assistant and your response needs to be concise.", prompt_speech=None, add_history=False):
path = Path(output_audio_path)
path.parent.mkdir(parents=True, exist_ok=True)
text_response = self.model.spoken_dialogue_sft(input_speech, output_audio_path, system_prompt=system_prompt, prompt_speech=prompt_speech, add_history=add_history)
return text_response
def clear_history(self):
self.model.clear_history()
class Speech2TextDialogueGenerator:
def __init__(self, model, device=None):
self.model = model
self.device = device
def generate(self, input_speech, thinking=False, add_history=False):
text = self.model.speech2text_dialogue_sft(input_speech, thinking=thinking, add_history=add_history)
return text
def clear_history(self):
self.model.clear_history()
class TextDialogueGenerator:
def __init__(self, model, device=None):
self.model = model
self.device = device
def generate(self, input_text, thinking=False, add_history=False):
text = self.model.text_dialogue_sft(input_text, thinking=thinking, add_history=add_history)
return text
def clear_history(self):
self.model.clear_history()
class MultiModalSpeechInterface:
def __init__(self):
self.model = None
self.tts_generator = None
self.audio_understanding_generator = None
self.spoken_dialogue_generator = None
self.speech2text_dialogue_generator = None
self.text_dialogue_generator = None
self.device = None
self.model_initialized = False
def initialize_model(self, model_path=None, tokenizer_path=None):
try:
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
if model_path is None:
model_path = "./models/MiMo-Audio-7B-Instruct"
if tokenizer_path is None:
tokenizer_path = "./models/MiMo-Audio-Tokenizer"
print(f"Model path: {model_path}")
print(f"Tokenizer path: {tokenizer_path}")
self.model = MimoAudio(model_path, tokenizer_path)
self.tts_generator = TTSGenerator(self.model, self.device)
self.audio_understanding_generator = AudioUnderstandingGenerator(self.model, self.device)
self.spoken_dialogue_generator = SpokenDialogueGenerator(self.model, self.device)
self.speech2text_dialogue_generator = Speech2TextDialogueGenerator(self.model, self.device)
self.text_dialogue_generator = TextDialogueGenerator(self.model, self.device)
self.model_initialized = True
print("Model loaded successfully!")
return "โ
Model loaded successfully!"
except Exception as e:
error_msg = f"โ Model loading failed: {str(e)}"
print(error_msg)
return error_msg
def generate_tts_audio(self, input_text, instruct="", use_instruct=False):
if not self.model_initialized:
return None, "โ Error: Model not initialized, please load the model first"
if not input_text.strip():
return None, "โ Error: Please input text content"
try:
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp_file:
output_path = tmp_file.name
if not (use_instruct and instruct.strip()):
instruct = None
print(f"Generating TTS audio: {input_text}")
text_channel = self.tts_generator.generate(input_text, instruct, output_path)
status_msg = f"โ
TTS audio generated successfully!\n๐ Input text: {input_text}"
if use_instruct and instruct is not None and instruct.strip():
status_msg += f"\n๐ญ Style description: {instruct}"
status_msg += f"\n๐ต Output text channel: {text_channel}"
return output_path, status_msg, gr.update(value=output_path, visible=True)
except Exception as e:
error_msg = f"โ Error generating TTS audio: {str(e)}"
print(error_msg)
return None, error_msg, gr.update(visible=False)
def generate_audio_understanding_response(self, input_audio, input_text, thinking=False):
if not self.model_initialized:
return "", "โ Error: Model not initialized, please load the model first"
if input_audio is None and not input_text.strip():
return "", "โ Error: Please provide either audio input or text question"
if input_audio is None:
return "", "โ Error: Please upload an audio file for Audio Understanding task"
if not input_text.strip():
return "", "โ Error: Please input your question"
try:
print(f"Performing Audio Understanding task:")
print(f"Audio input: {input_audio}")
print(f"Text question: {input_text}")
audio_understanding_response = self.audio_understanding_generator.generate(input_audio, input_text.strip(), thinking=thinking)
status_msg = f"โ
Audio Understanding task completed successfully!\n๐ต Audio input: {os.path.basename(input_audio)}\nโ Question: {input_text}\n๐ฌ Answer: {audio_understanding_response}"
return audio_understanding_response, status_msg
except Exception as e:
error_msg = f"โ Error performing Audio Understanding task: {str(e)}"
print(error_msg)
return "", error_msg
def generate_spoken_dialogue_response(self, input_audio, system_prompt=None, prompt_speech=None, add_history=False):
if not self.model_initialized:
return "", "โ Error: Model not initialized, please load the model first"
if input_audio is None:
return "", "โ Error: Please upload an audio file"
try:
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp_file:
output_audio_path = tmp_file.name
print(f"Performing spoken dialogue task:")
print(f"Audio input: {input_audio}")
print(f"Output path: {output_audio_path}")
dialogue_response = self.spoken_dialogue_generator.generate(input_audio, output_audio_path, system_prompt=system_prompt, prompt_speech=prompt_speech, add_history=add_history)
status_msg = f"โ
Spoken dialogue task completed successfully!\n๐ต Audio input: {os.path.basename(input_audio)}\n๐ฌ Response: {dialogue_response[:300]}..."
return output_audio_path, dialogue_response, status_msg
except Exception as e:
error_msg = f"โ Error performing spoken dialogue task: {str(e)}"
print(error_msg)
return None, None, error_msg
def generate_speech2text_dialogue_response(self, input_audio, thinking=False, add_history=False):
if not self.model_initialized:
return "", "โ Error: Model not initialized, please load the model first"
if input_audio is None:
return "", "โ Error: Please upload an audio file for S2T Dialogue task"
try:
print(f"Performing S2T Dialogue task:")
print(f"Audio input: {input_audio}")
s2t_response = self.speech2text_dialogue_generator.generate(input_audio, thinking=thinking, add_history=add_history)
status_msg = f"โ
S2T dialogue task completed successfully!\n๐ต Audio input: {os.path.basename(input_audio)}\nโ๐ฌ Answer: {s2t_response}"
return s2t_response, status_msg
except Exception as e:
error_msg = f"โ Error performing QA task: {str(e)}"
print(error_msg)
return "", error_msg
def generate_text_dialogue_response(self, input_text, thinking=False, add_history=False):
if not self.model_initialized:
return "", "โ Error: Model not initialized, please load the model first"
if not input_text or not input_text.strip():
return "", "โ Error: Please input your text"
try:
print(f"Performing Text Dialogue task:")
print(f"Text input: {input_text}")
print(f"Thinking mode: {thinking}")
print(f"Add history: {add_history}")
t2t_response = self.text_dialogue_generator.generate(input_text.strip(), thinking=thinking, add_history=add_history)
status_msg = f"โ
T2T dialogue task completed successfully!\n๐ฌ Input: {input_text}"
if thinking:
status_msg += f"\n๐ง Thinking mode: Enabled"
status_msg += f"\n๐ฌ Answer: {t2t_response}"
return t2t_response, status_msg
except Exception as e:
error_msg = f"โ Error performing T2T dialogue task: {str(e)}"
print(error_msg)
return "", error_msg
def clear_spoken_dialogue_history(self):
if not self.model_initialized:
return None, "", "โ Error: Model not initialized, please load the model first"
try:
self.spoken_dialogue_generator.clear_history()
return None, "", "โ
Spoken dialogue history cleared successfully!"
except Exception as e:
error_msg = f"โ Error clearing spoken dialogue history: {str(e)}"
print(error_msg)
return None, "", error_msg
def clear_speech2text_dialogue_history(self):
if not self.model_initialized:
return "", "โ Error: Model not initialized, please load the model first"
try:
self.speech2text_dialogue_generator.clear_history()
return "", "โ
Speech-to-text dialogue history cleared successfully!"
except Exception as e:
error_msg = f"โ Error clearing S2T dialogue history: {str(e)}"
print(error_msg)
return "", error_msg
def clear_text_dialogue_history(self):
if not self.model_initialized:
return "", "โ Error: Model not initialized, please load the model first"
try:
self.text_dialogue_generator.clear_history()
return "", "โ
Text dialogue history cleared successfully!"
except Exception as e:
error_msg = f"โ Error clearing T2T dialogue history: {str(e)}"
print(error_msg)
return "", error_msg
def create_interface(self):
with gr.Blocks(title="MiMo-Audio Multimodal Speech Processing System", theme=gr.themes.Soft()) as iface:
gr.Markdown("# ๐ต MiMo-Audio Multimodal Speech Processing System")
gr.Markdown("Supports audio understanding, text-to-speech, spoken dialogue, speech-to-text dialogue and text-to-text dialogue")
with gr.Tabs():
with gr.TabItem("โ๏ธ Model Configuration"):
gr.Markdown("### ๐ Model initialization configuration")
with gr.Row():
with gr.Column():
model_path = gr.Textbox(
label="Model path",
placeholder="Leave blank to use default path: ./models/MiMo-Audio-7B-Instruct",
lines=3
)
tokenizer_path = gr.Textbox(
label="Tokenizer path",
placeholder="Leave blank to use default path: ./models/MiMo-Audio-Tokenizer",
lines=3
)
init_btn = gr.Button("๐ Initialize model", variant="primary", size="lg")
with gr.Column():
init_status = gr.Textbox(
label="Initialization status",
interactive=False,
lines=6,
placeholder="Click the initialize model button to start..."
)
gr.Markdown("### ๐ป System information")
device_info = gr.Textbox(
label="Device information",
value=f"GPU available: {'Yes' if torch.cuda.is_available() else 'No'}",
interactive=False
)
with gr.TabItem("๐ Audio Understanding"):
gr.Markdown("### ๐ฏ Audio Understanding")
with gr.Row():
with gr.Column():
audio_understanding_input_audio = gr.Audio(
label="Upload Audio File",
type="filepath",
interactive=True,
)
audio_understanding_input_text = gr.Textbox(
label="Input Question",
placeholder="Please input your question...",
lines=3,
)
audio_understanding_thinking = gr.Checkbox(
label="Enable Thinking Mode",
value=False,
info="Enable thinking mode, AI will perform a deeper analysis and thinking"
)
audio_understanding_generate_btn = gr.Button("๐ค Start Audio Understanding", variant="primary", size="lg")
with gr.Column():
audio_understanding_output_text = gr.Textbox(
label="Answer Result",
lines=8,
interactive=False,
placeholder="AI's answer will be displayed here...",
elem_id="audio_understanding_output_text"
)
audio_understanding_status = gr.Textbox(
label="Processing Status",
lines=6,
interactive=False,
placeholder="Processing status information will be displayed here..."
)
with gr.Row():
audio_understanding_copy_btn = gr.Button("๐ Copy Answer", size="sm")
audio_understanding_clear_btn = gr.Button("๐๏ธ Clear Result", size="sm")
gr.Markdown("### ๐ Audio Understanding Examples")
audio_understanding_examples = gr.Examples(
examples=[
[None, "่ฟๆฎต้ณ้ข็ไธป่ฆๅ
ๅฎนๆฏไปไน๏ผ"],
[None, "่ฏด่ฏ่
็ๆ
ๆ็ถๆๅฆไฝ๏ผ"],
[None, "้ณ้ขไธญๆๅฐไบๅชไบๅ
ณ้ฎไฟกๆฏ๏ผ"],
[None, "Please summarize the main points of this conversation."],
[None, "What viewpoint does the speaker want to express?"]
],
inputs=[audio_understanding_input_audio, audio_understanding_input_text],
label="Click the example to automatically fill the question"
)
with gr.TabItem("๐ต Text-to-Speech"):
gr.Markdown("### ๐ต Text-to-Speech")
with gr.Row():
with gr.Column():
tts_input_text = gr.Textbox(
label="Input Text",
placeholder="Please input the text you want to convert to speech...",
lines=4,
max_lines=8
)
tts_instruct = gr.Textbox(
label="Style Description (Optional)",
placeholder="Please input the style description (optional)...",
lines=3,
max_lines=5
)
tts_use_instruct = gr.Checkbox(
label="Use Style Description",
value=True,
info="Enable to use InstructTTS for style-controlled speech generation"
)
tts_generate_btn = gr.Button("๐ต Generate Speech", variant="primary", size="lg")
with gr.Column():
tts_output_audio = gr.Audio(
label="Generated Speech",
type="filepath"
)
tts_status = gr.Textbox(
label="Generation Status",
lines=6,
interactive=False
)
tts_download_btn = gr.DownloadButton(
label="Download Generated Audio",
visible=False
)
with gr.TabItem("๐ค Spoken Dialogue"):
gr.Markdown("### ๐ฏ Spoken Dialogue")
with gr.Row():
with gr.Column():
dialogue_input_audio = gr.Audio(
label="Upload User Speech",
type="filepath",
interactive=True
)
system_prompt = gr.Textbox(
label="System Prompt (Optional)",
placeholder="e.g.: You are MiMo-Audio, a friendly AI assistant and your response needs to be concise.",
lines=1
)
prompt_speech = gr.Audio(
label="Prompt Speech (Optional, MiMo-Audio speaks with the same timbre as your prompt.)",
type="filepath",
interactive=True
)
spoken_dialogue_add_history = gr.Checkbox(
label="Enable History Record",
value=True,
info="Enable to remember the previous dialogue context"
)
with gr.Row():
dialogue_generate_btn = gr.Button("๐ฌ Start Dialogue", variant="primary", size="lg")
with gr.Row():
dialogue_clear_history_btn = gr.Button("๐๏ธ Clear Dialogue History", size="sm", variant="secondary")
with gr.Column():
dialogue_output_audio = gr.Audio(
label="Output Audio",
type="filepath"
)
dialogue_output_text = gr.Textbox(
label="Dialogue Response",
lines=5,
interactive=False,
)
dialogue_status = gr.Textbox(
label="Dialogue Status",
lines=5,
interactive=False,
)
with gr.TabItem("๐ฌ S2T Dialogue"):
gr.Markdown("### ๐ฏ S2T Dialogue")
with gr.Row():
with gr.Column():
s2t_dialogue_input_audio = gr.Audio(
label="Upload User Speech",
type="filepath",
interactive=True
)
s2t_dialogue_add_history = gr.Checkbox(
label="Enable History Record",
value=True,
info="Enable to remember the previous dialogue context"
)
s2t_dialogue_thinking = gr.Checkbox(
label="Enable Thinking Mode (think mode)",
value=False,
info="Enable to perform a deeper analysis and reasoning"
)
with gr.Row():
s2t_dialogue_generate_btn = gr.Button("๐ง Start S2T Dialogue", variant="primary", size="lg")
with gr.Row():
s2t_dialogue_clear_history_btn = gr.Button("๐๏ธ Clear Dialogue History", size="sm", variant="secondary")
with gr.Column():
s2t_dialogue_output_text = gr.Textbox(
label="Dialogue Response",
lines=8,
interactive=False,
placeholder="AI's dialogue response will be displayed here..."
)
s2t_dialogue_status = gr.Textbox(
label="Dialogue Status",
lines=5,
interactive=False,
placeholder="Dialogue status information will be displayed here..."
)
with gr.TabItem("๐ T2T Dialogue"):
gr.Markdown("### ๐ฏ T2T Dialogue")
with gr.Row():
with gr.Column():
t2t_dialogue_input_text = gr.Textbox(
label="Input Dialogue Content",
placeholder="Please input the text content you want to dialogue...",
lines=4,
max_lines=8
)
t2t_dialogue_add_history = gr.Checkbox(
label="Enable History Record",
value=True,
info="Enable to remember the previous dialogue context"
)
t2t_dialogue_thinking = gr.Checkbox(
label="Enable Thinking Mode (Thinking)",
value=False,
info="Enable thinking mode, AI will perform a deeper analysis and thinking"
)
with gr.Row():
t2t_dialogue_generate_btn = gr.Button("๐ฌ Start T2T Dialogue", variant="primary", size="lg")
with gr.Row():
t2t_dialogue_clear_history_btn = gr.Button("๐๏ธ Clear Dialogue History", size="sm", variant="secondary")
with gr.Column():
t2t_dialogue_output_text = gr.Textbox(
label="Dialogue Response",
lines=8,
interactive=False,
placeholder="AI's dialogue response will be displayed here..."
)
t2t_dialogue_status = gr.Textbox(
label="Dialogue Status",
lines=5,
interactive=False,
placeholder="Dialogue status information will be displayed here..."
)
gr.Markdown("### ๐ T2T Dialogue Examples")
t2t_dialogue_examples = gr.Examples(
examples=[
["Hello, how are you?"],
["I want to know the history of the development of artificial intelligence"],
["Please recommend some good movies"],
["Can you help me explain the basic concepts of quantum physics?"],
["I'm learning programming recently, any suggestions?"]
],
inputs=[t2t_dialogue_input_text],
label="Click the example to automatically fill the dialogue content"
)
def copy_text_to_clipboard(text):
return text
def clear_audio_understanding_results():
return "", "๐๏ธ Audio Understanding Result Cleared"
init_btn.click(
fn=lambda path, tok_path: self.initialize_model(path or None, tok_path or None),
inputs=[model_path, tokenizer_path],
outputs=[init_status]
)
audio_understanding_generate_btn.click(
fn=self.generate_audio_understanding_response,
inputs=[audio_understanding_input_audio, audio_understanding_input_text, audio_understanding_thinking],
outputs=[audio_understanding_output_text, audio_understanding_status]
)
audio_understanding_copy_btn.click(
fn=None,
inputs=[audio_understanding_output_text],
js="(text) => {navigator.clipboard.writeText(text); alert('Copied to clipboard!')}"
)
tts_generate_btn.click(
fn=self.generate_tts_audio,
inputs=[tts_input_text, tts_instruct, tts_use_instruct],
outputs=[tts_output_audio, tts_status, tts_download_btn]
)
dialogue_generate_btn.click(
fn=self.generate_spoken_dialogue_response,
inputs=[dialogue_input_audio, system_prompt, prompt_speech, spoken_dialogue_add_history],
outputs=[dialogue_output_audio, dialogue_output_text, dialogue_status]
)
dialogue_clear_history_btn.click(
fn=self.clear_spoken_dialogue_history,
outputs=[dialogue_output_audio, dialogue_output_text, dialogue_status]
)
s2t_dialogue_generate_btn.click(
fn=self.generate_speech2text_dialogue_response,
inputs=[s2t_dialogue_input_audio, s2t_dialogue_thinking, s2t_dialogue_add_history],
outputs=[s2t_dialogue_output_text, s2t_dialogue_status]
)
s2t_dialogue_clear_history_btn.click(
fn=self.clear_speech2text_dialogue_history,
outputs=[s2t_dialogue_output_text, s2t_dialogue_status]
)
t2t_dialogue_generate_btn.click(
fn=self.generate_text_dialogue_response,
inputs=[t2t_dialogue_input_text, t2t_dialogue_thinking, t2t_dialogue_add_history],
outputs=[t2t_dialogue_output_text, t2t_dialogue_status]
)
t2t_dialogue_clear_history_btn.click(
fn=self.clear_text_dialogue_history,
outputs=[t2t_dialogue_output_text, t2t_dialogue_status]
)
audio_understanding_clear_btn.click(
fn=clear_audio_understanding_results,
outputs=[audio_understanding_output_text, audio_understanding_status]
)
tts_input_text.submit(
fn=self.generate_tts_audio,
inputs=[tts_input_text, tts_instruct, tts_use_instruct],
outputs=[tts_output_audio, tts_status, tts_download_btn]
)
audio_understanding_input_text.submit(
fn=self.generate_audio_understanding_response,
inputs=[audio_understanding_input_audio, audio_understanding_input_text, audio_understanding_thinking],
outputs=[audio_understanding_output_text, audio_understanding_status]
)
t2t_dialogue_input_text.submit(
fn=self.generate_text_dialogue_response,
inputs=[t2t_dialogue_input_text, t2t_dialogue_thinking, t2t_dialogue_add_history],
outputs=[t2t_dialogue_output_text, t2t_dialogue_status]
)
return iface
def main():
parser = argparse.ArgumentParser(description="MiMo-Audio")
parser.add_argument("--host", default="0.0.0.0", help="Server Address")
parser.add_argument("--port", type=int, default=7897, help="Port")
parser.add_argument("--share", action="store_true", help="Create Public Link")
parser.add_argument("--debug", action="store_true", help="Debug Mode")
args = parser.parse_args()
print("๐ Launch MiMo-Audio...")
speech_interface = MultiModalSpeechInterface()
print("๐จ Create Gradio Interface...")
iface = speech_interface.create_interface()
print(f"๐ Launch Service - Address: {args.host}:{args.port}")
iface.launch(
server_name=args.host,
server_port=args.port,
share=args.share,
debug=args.debug
)
if __name__ == "__main__":
main() |