Spaces:
Running
Running
Update gui.py
Browse files
gui.py
CHANGED
|
@@ -4,8 +4,6 @@ import torch
|
|
| 4 |
import logging
|
| 5 |
from yt_dlp import YoutubeDL
|
| 6 |
import gradio as gr
|
| 7 |
-
import argparse
|
| 8 |
-
from audio_separator.separator import Separator
|
| 9 |
import numpy as np
|
| 10 |
import librosa
|
| 11 |
import soundfile as sf
|
|
@@ -113,7 +111,7 @@ ROFORMER_MODELS = {
|
|
| 113 |
|
| 114 |
OUTPUT_FORMATS = ['wav', 'flac', 'mp3', 'ogg', 'opus', 'm4a', 'aiff', 'ac3']
|
| 115 |
|
| 116 |
-
# CSS (
|
| 117 |
CSS = """
|
| 118 |
/* Modern ve Etkileşimli Tema */
|
| 119 |
#app-container {
|
|
@@ -495,7 +493,7 @@ def create_interface():
|
|
| 495 |
with gr.Row():
|
| 496 |
roformer_audio = gr.Audio(label="🎧 Upload Audio", type="filepath", interactive=True)
|
| 497 |
url_ro = gr.Textbox(label="🔗 Or Paste URL", placeholder="YouTube or audio URL", interactive=True)
|
| 498 |
-
download_roformer = gr.Button("⬇️
|
| 499 |
roformer_exclude_stems = gr.Textbox(label="🚫 Exclude Stems", placeholder="e.g., vocals, drums (comma-separated)", interactive=True)
|
| 500 |
with gr.Row():
|
| 501 |
roformer_category = gr.Dropdown(label="📚 Category", choices=list(ROFORMER_MODELS.keys()), value="General Purpose", interactive=True)
|
|
@@ -518,7 +516,7 @@ def create_interface():
|
|
| 518 |
with gr.Row():
|
| 519 |
ensemble_audio = gr.Audio(label="🎧 Upload Audio", type="filepath", interactive=True)
|
| 520 |
url_ensemble = gr.Textbox(label="🔗 Or Paste URL", placeholder="YouTube or audio URL", interactive=True)
|
| 521 |
-
download_ensemble = gr.Button("⬇️
|
| 522 |
ensemble_exclude_stems = gr.Textbox(label="🚫 Exclude Stems", placeholder="e.g., vocals, drums (comma-separated)", interactive=True)
|
| 523 |
with gr.Row():
|
| 524 |
ensemble_category = gr.Dropdown(label="📚 Category", choices=list(ROFORMER_MODELS.keys()), value="Instrumentals", interactive=True)
|
|
@@ -535,7 +533,7 @@ def create_interface():
|
|
| 535 |
|
| 536 |
gr.HTML("<div class='footer'>Powered by Audio-Separator 🌟🎶 | Made with ❤️</div>")
|
| 537 |
|
| 538 |
-
# Event Handlers
|
| 539 |
roformer_category.change(update_roformer_models, inputs=[roformer_category], outputs=[roformer_model])
|
| 540 |
download_roformer.click(fn=download_audio, inputs=[url_ro], outputs=[roformer_audio])
|
| 541 |
roformer_button.click(
|
|
@@ -556,18 +554,6 @@ def create_interface():
|
|
| 556 |
|
| 557 |
return app
|
| 558 |
|
| 559 |
-
parser.add_argument("--ngrok-token", type=str, default=None, help="Ngrok token for tunneling")
|
| 560 |
-
args = parser.parse_args()
|
| 561 |
-
|
| 562 |
-
|
| 563 |
if __name__ == "__main__":
|
| 564 |
-
app = create_interface()
|
| 565 |
-
|
| 566 |
-
if args.ngrok_token:
|
| 567 |
-
from pyngrok import ngrok
|
| 568 |
-
ngrok.set_auth_token(args.ngrok_token)
|
| 569 |
-
public_url = ngrok.connect(args.port, "http")
|
| 570 |
-
print(f"Ngrok URL: {public_url}")
|
| 571 |
-
app.launch(server_name="0.0.0.0", server_port=args.port)
|
| 572 |
-
else:
|
| 573 |
-
app.launch(server_name="0.0.0.0", server_port=args.port, share=True)
|
|
|
|
| 4 |
import logging
|
| 5 |
from yt_dlp import YoutubeDL
|
| 6 |
import gradio as gr
|
|
|
|
|
|
|
| 7 |
import numpy as np
|
| 8 |
import librosa
|
| 9 |
import soundfile as sf
|
|
|
|
| 111 |
|
| 112 |
OUTPUT_FORMATS = ['wav', 'flac', 'mp3', 'ogg', 'opus', 'm4a', 'aiff', 'ac3']
|
| 113 |
|
| 114 |
+
# CSS (same as provided)
|
| 115 |
CSS = """
|
| 116 |
/* Modern ve Etkileşimli Tema */
|
| 117 |
#app-container {
|
|
|
|
| 493 |
with gr.Row():
|
| 494 |
roformer_audio = gr.Audio(label="🎧 Upload Audio", type="filepath", interactive=True)
|
| 495 |
url_ro = gr.Textbox(label="🔗 Or Paste URL", placeholder="YouTube or audio URL", interactive=True)
|
| 496 |
+
download_roformer = gr.Button("⬇️ Download", variant="secondary")
|
| 497 |
roformer_exclude_stems = gr.Textbox(label="🚫 Exclude Stems", placeholder="e.g., vocals, drums (comma-separated)", interactive=True)
|
| 498 |
with gr.Row():
|
| 499 |
roformer_category = gr.Dropdown(label="📚 Category", choices=list(ROFORMER_MODELS.keys()), value="General Purpose", interactive=True)
|
|
|
|
| 516 |
with gr.Row():
|
| 517 |
ensemble_audio = gr.Audio(label="🎧 Upload Audio", type="filepath", interactive=True)
|
| 518 |
url_ensemble = gr.Textbox(label="🔗 Or Paste URL", placeholder="YouTube or audio URL", interactive=True)
|
| 519 |
+
download_ensemble = gr.Button("⬇️ Download", variant="secondary")
|
| 520 |
ensemble_exclude_stems = gr.Textbox(label="🚫 Exclude Stems", placeholder="e.g., vocals, drums (comma-separated)", interactive=True)
|
| 521 |
with gr.Row():
|
| 522 |
ensemble_category = gr.Dropdown(label="📚 Category", choices=list(ROFORMER_MODELS.keys()), value="Instrumentals", interactive=True)
|
|
|
|
| 533 |
|
| 534 |
gr.HTML("<div class='footer'>Powered by Audio-Separator 🌟🎶 | Made with ❤️</div>")
|
| 535 |
|
| 536 |
+
# Event Handlers
|
| 537 |
roformer_category.change(update_roformer_models, inputs=[roformer_category], outputs=[roformer_model])
|
| 538 |
download_roformer.click(fn=download_audio, inputs=[url_ro], outputs=[roformer_audio])
|
| 539 |
roformer_button.click(
|
|
|
|
| 554 |
|
| 555 |
return app
|
| 556 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 557 |
if __name__ == "__main__":
|
| 558 |
+
app = create_interface()
|
| 559 |
+
app.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|