Spaces:
Building
on
L40S
Building
on
L40S
Update app.py
Browse files
app.py
CHANGED
@@ -639,28 +639,34 @@ Don't let this moment fade, hold me close tonight
|
|
639 |
inputs=[lyrics_txt],
|
640 |
outputs=[duration_info, sections_info]
|
641 |
)
|
642 |
-
|
|
|
643 |
def generate_with_progress(genre, lyrics, segments, tokens, history):
|
644 |
-
progress.update(value="π΅ Starting generation...")
|
645 |
try:
|
|
|
|
|
646 |
result = infer(genre, lyrics, segments, tokens)
|
|
|
647 |
if result:
|
648 |
-
|
649 |
new_history, history_html = update_history(result, genre, lyrics, history)
|
650 |
-
return result, new_history, history_html
|
651 |
else:
|
652 |
-
|
653 |
-
return None, history, ""
|
654 |
except Exception as e:
|
655 |
-
|
656 |
-
return None, history, ""
|
657 |
|
|
|
658 |
submit_btn.click(
|
659 |
fn=generate_with_progress,
|
660 |
inputs=[genre_txt, lyrics_txt, num_segments, max_new_tokens, history_state],
|
661 |
-
outputs=[music_out, history_state, history_container]
|
662 |
)
|
663 |
|
|
|
|
|
664 |
return demo
|
665 |
|
666 |
if __name__ == "__main__":
|
|
|
639 |
inputs=[lyrics_txt],
|
640 |
outputs=[duration_info, sections_info]
|
641 |
)
|
642 |
+
|
643 |
+
|
644 |
def generate_with_progress(genre, lyrics, segments, tokens, history):
|
|
|
645 |
try:
|
646 |
+
# μ§ν μνλ₯Ό λ°νκ°μ ν¬ν¨
|
647 |
+
status_text = "π΅ Starting generation..."
|
648 |
result = infer(genre, lyrics, segments, tokens)
|
649 |
+
|
650 |
if result:
|
651 |
+
status_text = "β
Generation complete!"
|
652 |
new_history, history_html = update_history(result, genre, lyrics, history)
|
653 |
+
return result, new_history, history_html, status_text
|
654 |
else:
|
655 |
+
status_text = "β Generation failed"
|
656 |
+
return None, history, "", status_text
|
657 |
except Exception as e:
|
658 |
+
status_text = f"β Error: {str(e)}"
|
659 |
+
return None, history, "", status_text
|
660 |
|
661 |
+
# submit_btn.click μ΄λ²€νΈ νΈλ€λ¬λ μμ
|
662 |
submit_btn.click(
|
663 |
fn=generate_with_progress,
|
664 |
inputs=[genre_txt, lyrics_txt, num_segments, max_new_tokens, history_state],
|
665 |
+
outputs=[music_out, history_state, history_container, progress]
|
666 |
)
|
667 |
|
668 |
+
|
669 |
+
|
670 |
return demo
|
671 |
|
672 |
if __name__ == "__main__":
|