Update app.py
Browse files
app.py
CHANGED
|
@@ -21,18 +21,6 @@ logging.basicConfig(
|
|
| 21 |
)
|
| 22 |
|
| 23 |
|
| 24 |
-
# ํ๋ก์ ํธ ๋ฃจํธ ๋๋ ํ ๋ฆฌ์์ samples ํด๋ ๊ฒฝ๋ก ์ค์
|
| 25 |
-
samples_dir = os.path.join(os.path.dirname(__file__), 'samples')
|
| 26 |
-
sample_audio_path = os.path.join(samples_dir, 'metal.mp3')
|
| 27 |
-
|
| 28 |
-
# samples ๋๋ ํ ๋ฆฌ๊ฐ ์๋ค๋ฉด ์์ฑ
|
| 29 |
-
os.makedirs(samples_dir, exist_ok=True)
|
| 30 |
-
|
| 31 |
-
# ์์ ์์
์ด ์กด์ฌํ๋์ง ํ์ธ
|
| 32 |
-
if os.path.exists(sample_audio_path):
|
| 33 |
-
gr.Audio(sample_audio_path, label="Sample Music")
|
| 34 |
-
else:
|
| 35 |
-
gr.Markdown("### Sample music file not found")
|
| 36 |
|
| 37 |
################################
|
| 38 |
# ๊ธฐ์กด์ ์ ์๋ ํจ์ ๋ฐ ๋ก์ง๋ค #
|
|
@@ -466,9 +454,16 @@ def update_info(lyrics):
|
|
| 466 |
)
|
| 467 |
|
| 468 |
def main():
|
| 469 |
-
# ์์คํ
์ด๊ธฐํ
|
| 470 |
initialize_system()
|
| 471 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 472 |
with gr.Blocks(css="""
|
| 473 |
/* ์ ์ฒด ๋ฐฐ๊ฒฝ ๋ฐ ์ปจํ
์ด๋ ์คํ์ผ */
|
| 474 |
body {
|
|
@@ -507,6 +502,22 @@ def main():
|
|
| 507 |
</div>
|
| 508 |
""")
|
| 509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 510 |
|
| 511 |
with gr.Row():
|
| 512 |
# ์ผ์ชฝ ์
๋ ฅ ์ปฌ๋ผ
|
|
@@ -524,7 +535,6 @@ def main():
|
|
| 524 |
|
| 525 |
# ์ค๋ฅธ์ชฝ ์ค์ /์ ๋ณด ์ปฌ๋ผ
|
| 526 |
with gr.Column():
|
| 527 |
-
# ์ฌ๊ธฐ์ gr.Box -> gr.Group๋ก ๋ณ๊ฒฝ
|
| 528 |
with gr.Group():
|
| 529 |
gr.Markdown("### Generation Settings")
|
| 530 |
num_segments = gr.Number(
|
|
@@ -544,7 +554,6 @@ def main():
|
|
| 544 |
interactive=False
|
| 545 |
)
|
| 546 |
|
| 547 |
-
# ์ฌ๊ธฐ์๋ gr.Box -> gr.Group๋ก ๋ณ๊ฒฝ
|
| 548 |
with gr.Group():
|
| 549 |
gr.Markdown("### Song Info")
|
| 550 |
duration_info = gr.Label(label="Estimated Duration")
|
|
@@ -552,7 +561,6 @@ def main():
|
|
| 552 |
|
| 553 |
submit_btn = gr.Button("Generate Music", variant="primary")
|
| 554 |
|
| 555 |
-
# ์๋๋ gr.Box -> gr.Group๋ก ๋ณ๊ฒฝ
|
| 556 |
with gr.Group():
|
| 557 |
music_out = gr.Audio(label="Generated Audio")
|
| 558 |
|
|
@@ -565,7 +573,6 @@ def main():
|
|
| 565 |
[verse]
|
| 566 |
Under the city lights, your hand in mine
|
| 567 |
Every step we take, feels like a sign
|
| 568 |
-
|
| 569 |
[chorus]
|
| 570 |
Baby, you're my everything, my heart is yours
|
| 571 |
"""
|
|
@@ -589,7 +596,6 @@ Baby, you're my everything, my heart is yours
|
|
| 589 |
[verse]
|
| 590 |
ๅคใฎ่กใซๅ
ใๅใฎ็ฌ้ก
|
| 591 |
ใฉใใชๆใใใฐใซใใใ
|
| 592 |
-
|
| 593 |
[chorus]
|
| 594 |
ใใฎๆฐๆใกๆญขใใใใชใ
|
| 595 |
"""
|
|
@@ -601,7 +607,6 @@ Baby, you're my everything, my heart is yours
|
|
| 601 |
[verse]
|
| 602 |
ๅค่ฒๆธฉๆๅไฝ ็ๆฅๆฑ
|
| 603 |
ๅฟ่ทณ้็ไฝ ๆ
ขๆ
ขๅ้ซ
|
| 604 |
-
|
| 605 |
[chorus]
|
| 606 |
ๆฐธ่ฟไธ่ฆๆพๅผๆ็ๆ
|
| 607 |
"""
|
|
|
|
| 21 |
)
|
| 22 |
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
################################
|
| 26 |
# ๊ธฐ์กด์ ์ ์๋ ํจ์ ๋ฐ ๋ก์ง๋ค #
|
|
|
|
| 454 |
)
|
| 455 |
|
| 456 |
def main():
|
| 457 |
+
# ์์คํ
์ด๊ธฐํ
|
| 458 |
initialize_system()
|
| 459 |
|
| 460 |
+
# samples ๋๋ ํ ๋ฆฌ ๋ฐ ์์ ํ์ผ ์ฒ๋ฆฌ
|
| 461 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 462 |
+
samples_dir = os.path.join(current_dir, 'samples')
|
| 463 |
+
sample_audio_path = os.path.join(samples_dir, 'metal.mp3')
|
| 464 |
+
|
| 465 |
+
os.makedirs(samples_dir, exist_ok=True)
|
| 466 |
+
|
| 467 |
with gr.Blocks(css="""
|
| 468 |
/* ์ ์ฒด ๋ฐฐ๊ฒฝ ๋ฐ ์ปจํ
์ด๋ ์คํ์ผ */
|
| 469 |
body {
|
|
|
|
| 502 |
</div>
|
| 503 |
""")
|
| 504 |
|
| 505 |
+
# ์์ ์์
์น์
|
| 506 |
+
with gr.Group():
|
| 507 |
+
gr.HTML("""
|
| 508 |
+
<div style="padding: 1rem; margin-bottom: 1.5rem; background-color: #f8f9fa; border-radius: 8px; text-align: center;">
|
| 509 |
+
<h3 style="margin: 0;">Sample Generated Music</h3>
|
| 510 |
+
<p style="color: #666; margin: 5px 0;">Listen to this example</p>
|
| 511 |
+
</div>
|
| 512 |
+
""")
|
| 513 |
+
if os.path.exists(sample_audio_path):
|
| 514 |
+
gr.Audio(
|
| 515 |
+
value=sample_audio_path,
|
| 516 |
+
label="Sample Music",
|
| 517 |
+
type="filepath"
|
| 518 |
+
)
|
| 519 |
+
else:
|
| 520 |
+
gr.Markdown("### Sample music file not available")
|
| 521 |
|
| 522 |
with gr.Row():
|
| 523 |
# ์ผ์ชฝ ์
๋ ฅ ์ปฌ๋ผ
|
|
|
|
| 535 |
|
| 536 |
# ์ค๋ฅธ์ชฝ ์ค์ /์ ๋ณด ์ปฌ๋ผ
|
| 537 |
with gr.Column():
|
|
|
|
| 538 |
with gr.Group():
|
| 539 |
gr.Markdown("### Generation Settings")
|
| 540 |
num_segments = gr.Number(
|
|
|
|
| 554 |
interactive=False
|
| 555 |
)
|
| 556 |
|
|
|
|
| 557 |
with gr.Group():
|
| 558 |
gr.Markdown("### Song Info")
|
| 559 |
duration_info = gr.Label(label="Estimated Duration")
|
|
|
|
| 561 |
|
| 562 |
submit_btn = gr.Button("Generate Music", variant="primary")
|
| 563 |
|
|
|
|
| 564 |
with gr.Group():
|
| 565 |
music_out = gr.Audio(label="Generated Audio")
|
| 566 |
|
|
|
|
| 573 |
[verse]
|
| 574 |
Under the city lights, your hand in mine
|
| 575 |
Every step we take, feels like a sign
|
|
|
|
| 576 |
[chorus]
|
| 577 |
Baby, you're my everything, my heart is yours
|
| 578 |
"""
|
|
|
|
| 596 |
[verse]
|
| 597 |
ๅคใฎ่กใซๅ
ใๅใฎ็ฌ้ก
|
| 598 |
ใฉใใชๆใใใฐใซใใใ
|
|
|
|
| 599 |
[chorus]
|
| 600 |
ใใฎๆฐๆใกๆญขใใใใชใ
|
| 601 |
"""
|
|
|
|
| 607 |
[verse]
|
| 608 |
ๅค่ฒๆธฉๆๅไฝ ็ๆฅๆฑ
|
| 609 |
ๅฟ่ทณ้็ไฝ ๆ
ขๆ
ขๅ้ซ
|
|
|
|
| 610 |
[chorus]
|
| 611 |
ๆฐธ่ฟไธ่ฆๆพๅผๆ็ๆ
|
| 612 |
"""
|