seawolf2357 commited on
Commit
baf199d
Β·
1 Parent(s): aab1d42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -62,9 +62,10 @@ def get_voices(language_id, dialect_id):
62
 
63
 
64
  # λΉ„λ””μ˜€ λ˜λŠ” μ˜€λ””μ˜€ 컨텐츠 μƒμ„±ν•˜λŠ” ν•¨μˆ˜.
65
- def generate_contents():
 
 
66
  url = API_HOME + END_GENERATE
67
- #VOICE_ID = '61b8b45a4268666c126bb32b' # English
68
  VOICE_ID = '65934ac2bc02ab1c006755fa' # Korean, Korea, Wolf Sea
69
 
70
  payload = {
@@ -74,7 +75,8 @@ def generate_contents():
74
  "content": user_content, # μ‚¬μš©μžκ°€ μž…λ ₯ν•œ ν…μŠ€νŠΈ
75
  "voiceId": VOICE_ID
76
  },
77
-
 
78
  "settings": {
79
  'aspectRatio': 'portrait', # 'portrait', 'square', 'horizontal'
80
  'subtitle': {
@@ -86,7 +88,7 @@ def generate_contents():
86
  },
87
  "backgroundMusicKeywords": "happy, lofi, beats"
88
  }
89
-
90
  headers = set_header()
91
  response = requests.request("POST", url, json=payload, headers=headers).json()
92
 
@@ -157,22 +159,17 @@ except Exception as e:
157
 
158
 
159
  # Gradio μΈν„°νŽ˜μ΄μŠ€λ₯Ό μœ„ν•œ ν•¨μˆ˜
160
- def gradio_generate_contents(brand_name):
161
- global brand
162
- brand = brand_name # μ‚¬μš©μž μž…λ ₯으둜 λΈŒλžœλ“œλͺ…을 μ„€μ •
163
- return generate_contents() # 컨텐츠 생성 ν•¨μˆ˜ 호좜
164
-
165
- def gradio_generate_status(content_id):
166
- return generate_status(content_id) # 컨텐츠 μƒνƒœ 확인 ν•¨μˆ˜ 호좜
167
 
168
- # Gradio μΈν„°νŽ˜μ΄μŠ€
169
  iface = gr.Interface(
170
  fn=gradio_generate_contents, # 컨텐츠 생성 ν•¨μˆ˜
171
- inputs=gr.inputs.Textbox(label="컨텐츠 ν…μŠ€"),
172
- inputs=gr.inputs.Textbox(label="λΈŒλžœλ“œ"),
173
  outputs=gr.outputs.Textbox(label="컨텐츠 ID")
174
  )
175
 
 
176
  status_iface = gr.Interface(
177
  fn=gradio_generate_status, # 컨텐츠 μƒνƒœ 확인 ν•¨μˆ˜
178
  inputs=gr.inputs.Textbox(label="컨텐츠 ID"),
 
62
 
63
 
64
  # λΉ„λ””μ˜€ λ˜λŠ” μ˜€λ””μ˜€ 컨텐츠 μƒμ„±ν•˜λŠ” ν•¨μˆ˜.
65
+ def generate_contents(user_content, brand_name):
66
+ global brand
67
+ brand = brand_name # λΈŒλžœλ“œλͺ… μ„€μ •
68
  url = API_HOME + END_GENERATE
 
69
  VOICE_ID = '65934ac2bc02ab1c006755fa' # Korean, Korea, Wolf Sea
70
 
71
  payload = {
 
75
  "content": user_content, # μ‚¬μš©μžκ°€ μž…λ ₯ν•œ ν…μŠ€νŠΈ
76
  "voiceId": VOICE_ID
77
  },
78
+ # ... λ‹€λ₯Έ 씬듀이 ν•„μš”ν•˜λ‹€λ©΄ 여기에 μΆ”κ°€ ...
79
+ ],
80
  "settings": {
81
  'aspectRatio': 'portrait', # 'portrait', 'square', 'horizontal'
82
  'subtitle': {
 
88
  },
89
  "backgroundMusicKeywords": "happy, lofi, beats"
90
  }
91
+
92
  headers = set_header()
93
  response = requests.request("POST", url, json=payload, headers=headers).json()
94
 
 
159
 
160
 
161
  # Gradio μΈν„°νŽ˜μ΄μŠ€λ₯Ό μœ„ν•œ ν•¨μˆ˜
162
+ def gradio_generate_contents(user_content, brand_name):
163
+ return generate_contents(user_content, brand_name) # 두 μž…λ ₯ λͺ¨λ‘ 전달
 
 
 
 
 
164
 
165
+ # Gradio μΈν„°νŽ˜μ΄μŠ€ μˆ˜μ •
166
  iface = gr.Interface(
167
  fn=gradio_generate_contents, # 컨텐츠 생성 ν•¨μˆ˜
168
+ inputs=[gr.inputs.Textbox(label="컨텐츠 ν…μŠ€νŠΈ"), gr.inputs.Textbox(label="λΈŒλžœλ“œλͺ…")],
 
169
  outputs=gr.outputs.Textbox(label="컨텐츠 ID")
170
  )
171
 
172
+
173
  status_iface = gr.Interface(
174
  fn=gradio_generate_status, # 컨텐츠 μƒνƒœ 확인 ν•¨μˆ˜
175
  inputs=gr.inputs.Textbox(label="컨텐츠 ID"),