seawolf2357 commited on
Commit
311fb46
Β·
1 Parent(s): d8bb1cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -2,10 +2,23 @@ import gradio as gr
2
  import requests
3
 
4
  def generate_audio(text, voice_name):
5
-
 
 
 
 
 
 
 
 
 
 
 
 
6
  MAX_CHARS = 100
7
- # μž…λ ₯된 ν…μŠ€νŠΈ 길이 검증
8
- if len(text) > MAX_CHARS:
 
9
  text = text[:MAX_CHARS] # μ΅œλŒ€ κΈ€μžμˆ˜λ‘œ ν…μŠ€νŠΈ 자λ₯΄κΈ°
10
 
11
  voices = {
 
2
  import requests
3
 
4
  def generate_audio(text, voice_name):
5
+
6
+ # 각 μŒμ„± μ˜΅μ…˜μ— λŒ€ν•œ κΈ°λ³Έ ν…μŠ€νŠΈ μ˜ˆμ‹œ
7
+ default_examples = {
8
+ "남성AI": "μ•ˆλ…•ν•˜μ„Έμš”, 남성 AI ν‘œμ€€ μŒμ„±μž…λ‹ˆλ‹€.",
9
+ "μ—¬μ„±AI": "μ•ˆλ…•ν•˜μ„Έμš”, μ—¬μ„± AI ν‘œμ€€ μŒμ„±μž…λ‹ˆλ‹€.",
10
+ "νŠΈλŸΌν”„": "Make, America, Great, Again! , λ‹€μ‹œ, μœ„λŒ€ν•œ, 미ꡭ을, λ§Œλ“­μ‹œλ‹€!",
11
+ "μ°¨μŠΉμ›": "μ•ˆλ…•ν•˜μ„Έμš”, μƒˆν•΄ 볡 많이 λ°›μœΌμ‹œκΈΈ κΈ°μ›ν•©λ‹ˆλ‹€.",
12
+ "김정은": "μ•ˆλ…•ν•˜μ„Έμš”, μƒˆν•΄ 볡 많이 λ°›μœΌμ‹œκΈΈ κΈ°μ›ν•©λ‹ˆλ‹€.",
13
+ "λ…Έλ¬΄ν˜„": "μ•ˆλ…•ν•˜μ„Έμš”, μƒˆν•΄ 볡 많이 λ°›μœΌμ‹œκΈΈ κΈ°μ›ν•©λ‹ˆλ‹€.",
14
+ "ꢁ예": "μ•ˆλ…•ν•˜μ„Έμš”, λ―Έλ₯΅μ˜ κ°€λ₯΄μΉ¨μ€, μ˜΄λ§ˆλ‹ˆ λ°˜λ©”ν™ˆμ΄λ‹ˆλΌ.",
15
+ "μœ€μ„μ—΄": "μ•ˆλ…•ν•˜μ„Έμš”, μƒˆν•΄ 볡 많이 λ°›μœΌμ‹œκΈΈ κΈ°μ›ν•©λ‹ˆλ‹€."
16
+ }
17
+
18
  MAX_CHARS = 100
19
+ if not text:
20
+ text = default_examples[voice_name] # μ‚¬μš©μž μž…λ ₯이 μ—†μœΌλ©΄ κΈ°λ³Έ μ˜ˆμ‹œ μ‚¬μš©
21
+ elif len(text) > MAX_CHARS:
22
  text = text[:MAX_CHARS] # μ΅œλŒ€ κΈ€μžμˆ˜λ‘œ ν…μŠ€νŠΈ 자λ₯΄κΈ°
23
 
24
  voices = {