ginipick commited on
Commit
8c01fb9
Β·
verified Β·
1 Parent(s): 9f11480

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
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
- progress.update(value="βœ… Generation complete!")
649
  new_history, history_html = update_history(result, genre, lyrics, history)
650
- return result, new_history, history_html
651
  else:
652
- progress.update(value="❌ Generation failed")
653
- return None, history, ""
654
  except Exception as e:
655
- progress.update(value=f"❌ Error: {str(e)}")
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__":