ginipick commited on
Commit
13bfd1b
ยท
verified ยท
1 Parent(s): 86bd09d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -88,16 +88,19 @@ def calculate_generation_params(lyrics):
88
  }
89
 
90
  # ๊ฐ ์„น์…˜๋ณ„ ์˜ˆ์ƒ ์‹œ๊ฐ„ ๊ณ„์‚ฐ
91
- section_durations = {
92
- 'verse': section_lines['verse'] * time_per_line['verse'],
93
- 'chorus': section_lines['chorus'] * time_per_line['chorus'],
94
- 'bridge': section_lines['bridge'] * time_per_line['bridge']
95
- }
 
 
96
 
97
- total_duration = sum(section_durations.values())
 
98
  total_duration = max(60, total_duration) # ์ตœ์†Œ 60์ดˆ
99
 
100
- # ํ† ํฐ ๊ณ„์‚ฐ (๋” ๋ณด์ˆ˜์ ์ธ ๊ฐ’ ์‚ฌ์šฉ)
101
  base_tokens = 3000 # ๊ธฐ๋ณธ ํ† ํฐ ์ˆ˜
102
  tokens_per_line = 200 # ์ค„๋‹น ํ† ํฐ ์ˆ˜
103
 
 
88
  }
89
 
90
  # ๊ฐ ์„น์…˜๋ณ„ ์˜ˆ์ƒ ์‹œ๊ฐ„ ๊ณ„์‚ฐ
91
+ section_durations = {}
92
+ for section_type in ['verse', 'chorus', 'bridge']:
93
+ # ๊ฐ ์„น์…˜์˜ ๋ผ์ธ ์ˆ˜์— ํ•ด๋‹น ์„น์…˜์˜ ์‹œ๊ฐ„์„ ๊ณฑํ•จ
94
+ if isinstance(section_lines[section_type], list):
95
+ section_durations[section_type] = len(section_lines[section_type]) * time_per_line[section_type]
96
+ else:
97
+ section_durations[section_type] = section_lines[section_type] * time_per_line[section_type]
98
 
99
+ # ์ „์ฒด ์‹œ๊ฐ„ ๊ณ„์‚ฐ
100
+ total_duration = sum(duration for duration in section_durations.values())
101
  total_duration = max(60, total_duration) # ์ตœ์†Œ 60์ดˆ
102
 
103
+ # ํ† ํฐ ๊ณ„์‚ฐ
104
  base_tokens = 3000 # ๊ธฐ๋ณธ ํ† ํฐ ์ˆ˜
105
  tokens_per_line = 200 # ์ค„๋‹น ํ† ํฐ ์ˆ˜
106