seawolf2357 commited on
Commit
f9f982e
ยท
verified ยท
1 Parent(s): 1e59355

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -25
app.py CHANGED
@@ -174,23 +174,27 @@ async def image_to_video(prompt, image_url, loop, aspect_ratio, camera_motion, p
174
  return None, f"An error occurred: {str(e)}"
175
 
176
  with gr.Blocks() as demo:
177
- gr.Markdown("# Luma AI Text-to-Video Demo")
178
 
179
- with gr.Tab("Text to Video"):
180
- prompt = gr.Textbox(label="Prompt")
181
- generate_btn = gr.Button("Generate Video")
182
- video_output = gr.Video(label="Generated Video")
183
- error_output = gr.Textbox(label="Error Messages", visible=True)
184
 
185
- with gr.Accordion("Advanced Options", open=False):
186
- loop = gr.Checkbox(label="Loop", value=False)
187
- aspect_ratio = gr.Dropdown(label="Aspect Ratio", choices=["16:9", "1:1", "9:16", "4:3", "3:4"], value="16:9")
188
- camera_motion = gr.Dropdown(label="Camera Motion", choices=[])
189
- extend_id = gr.Textbox(label="Extend Video ID (optional)")
190
- reverse_extend_id = gr.Textbox(label="Reverse Extend Video ID (optional)")
 
 
 
 
191
  with gr.Row():
192
- interpolate_id1 = gr.Textbox(label="Interpolate Video ID 1 (optional)")
193
- interpolate_id2 = gr.Textbox(label="Interpolate Video ID 2 (optional)")
194
 
195
  generate_btn.click(
196
  text_to_video,
@@ -198,17 +202,21 @@ with gr.Blocks() as demo:
198
  outputs=[video_output, error_output]
199
  )
200
 
201
- with gr.Tab("Image to Video"):
202
- img_prompt = gr.Textbox(label="Prompt")
203
- img_url = gr.Textbox(label="Image URL")
204
- img_generate_btn = gr.Button("Generate Video from Image")
205
- img_video_output = gr.Video(label="Generated Video")
206
- img_error_output = gr.Textbox(label="Error Messages", visible=True)
207
 
208
- with gr.Accordion("Advanced Options", open=False):
209
- img_loop = gr.Checkbox(label="Loop", value=False)
210
- img_aspect_ratio = gr.Dropdown(label="Aspect Ratio", choices=["16:9", "1:1", "9:16", "4:3", "3:4"], value="16:9")
211
- img_camera_motion = gr.Dropdown(label="Camera Motion", choices=[])
 
 
 
 
212
 
213
  img_generate_btn.click(
214
  image_to_video,
@@ -221,7 +229,7 @@ with gr.Blocks() as demo:
221
  motions = await get_camera_motions()
222
  return gr.update(choices=motions), gr.update(choices=motions)
223
  except Exception as e:
224
- print(f"Error updating camera motions: {str(e)}")
225
  return gr.update(choices=[]), gr.update(choices=[])
226
 
227
  demo.load(update_camera_motions, outputs=[camera_motion, img_camera_motion])
 
174
  return None, f"An error occurred: {str(e)}"
175
 
176
  with gr.Blocks() as demo:
177
+ gr.Markdown("# Luma AI ํ…์ŠคํŠธ-๋น„๋””์˜ค ์ƒ์„ฑ ๋ฐ๋ชจ")
178
 
179
+ with gr.Tab("ํ…์ŠคํŠธ๋กœ ๋น„๋””์˜ค ๋งŒ๋“ค๊ธฐ"):
180
+ prompt = gr.Textbox(label="ํ”„๋กฌํ”„ํŠธ (๋น„๋””์˜ค์— ๋Œ€ํ•œ ์„ค๋ช…์„ ์ž…๋ ฅํ•˜์„ธ์š”)")
181
+ generate_btn = gr.Button("๋น„๋””์˜ค ์ƒ์„ฑ")
182
+ video_output = gr.Video(label="์ƒ์„ฑ๋œ ๋น„๋””์˜ค")
183
+ error_output = gr.Textbox(label="์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€", visible=True)
184
 
185
+ with gr.Accordion("๊ณ ๊ธ‰ ์˜ต์…˜", open=False):
186
+ loop = gr.Checkbox(label="๋ฃจํ”„ (๋น„๋””์˜ค๋ฅผ ๋ฐ˜๋ณต ์žฌ์ƒํ• ์ง€ ์„ค์ •)", value=False)
187
+ aspect_ratio = gr.Dropdown(
188
+ label="ํ™”๋ฉด ๋น„์œจ",
189
+ choices=["16:9 (์™€์ด๋“œ์Šคํฌ๋ฆฐ)", "1:1 (์ •์‚ฌ๊ฐํ˜•)", "9:16 (์„ธ๋กœ ์˜์ƒ)", "4:3 (ํ‘œ์ค€)", "3:4 (์„ธ๋กœ ํ‘œ์ค€)"],
190
+ value="16:9 (์™€์ด๋“œ์Šคํฌ๋ฆฐ)"
191
+ )
192
+ camera_motion = gr.Dropdown(label="์นด๋ฉ”๋ผ ๋ชจ์…˜ (์นด๋ฉ”๋ผ ์›€์ง์ž„ ํšจ๊ณผ ์„ ํƒ)")
193
+ extend_id = gr.Textbox(label="ํ™•์žฅํ•  ๋น„๋””์˜ค ID (๊ธฐ์กด ๋น„๋””์˜ค๋ฅผ ์ด์–ด์„œ ์ƒ์„ฑํ•  ๋•Œ ์ž…๋ ฅ)")
194
+ reverse_extend_id = gr.Textbox(label="์—ญ๋ฐฉํ–ฅ ํ™•์žฅํ•  ๋น„๋””์˜ค ID (๊ธฐ์กด ๋น„๋””์˜ค์˜ ์•ž๋ถ€๋ถ„์„ ์ƒ์„ฑํ•  ๋•Œ ์ž…๋ ฅ)")
195
  with gr.Row():
196
+ interpolate_id1 = gr.Textbox(label="๋ณด๊ฐ„ ๋น„๋””์˜ค ID 1 (๋‘ ๋น„๋””์˜ค ์‚ฌ์ด๋ฅผ ๋ณด๊ฐ„ํ•  ๋•Œ ์ฒซ ๋ฒˆ์งธ ๋น„๋””์˜ค ID)")
197
+ interpolate_id2 = gr.Textbox(label="๋ณด๊ฐ„ ๋น„๋””์˜ค ID 2 (๋‘ ๋น„๋””์˜ค ์‚ฌ์ด๋ฅผ ๋ณด๊ฐ„ํ•  ๋•Œ ๋‘ ๋ฒˆ์งธ ๋น„๋””์˜ค ID)")
198
 
199
  generate_btn.click(
200
  text_to_video,
 
202
  outputs=[video_output, error_output]
203
  )
204
 
205
+ with gr.Tab("์ด๋ฏธ์ง€๋กœ ๋น„๋””์˜ค ๋งŒ๋“ค๊ธฐ"):
206
+ img_prompt = gr.Textbox(label="ํ”„๋กฌํ”„ํŠธ (์ด๋ฏธ์ง€๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ƒ์„ฑํ•  ๋น„๋””์˜ค์— ๋Œ€ํ•œ ์„ค๋ช…)")
207
+ img_url = gr.Textbox(label="์ด๋ฏธ์ง€ URL (๋ณ€ํ™˜ํ•˜๊ณ ์ž ํ•˜๋Š” ์ด๋ฏธ์ง€์˜ ์›น ์ฃผ์†Œ)")
208
+ img_generate_btn = gr.Button("์ด๋ฏธ์ง€๋กœ ๋น„๋””์˜ค ์ƒ์„ฑ")
209
+ img_video_output = gr.Video(label="์ƒ์„ฑ๋œ ๋น„๋””์˜ค")
210
+ img_error_output = gr.Textbox(label="์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€", visible=True)
211
 
212
+ with gr.Accordion("๊ณ ๊ธ‰ ์˜ต์…˜", open=False):
213
+ img_loop = gr.Checkbox(label="๋ฃจํ”„ (๋น„๋””์˜ค๋ฅผ ๋ฐ˜๋ณต ์žฌ์ƒํ• ์ง€ ์„ค์ •)", value=False)
214
+ img_aspect_ratio = gr.Dropdown(
215
+ label="ํ™”๋ฉด ๋น„์œจ",
216
+ choices=["16:9 (์™€์ด๋“œ์Šคํฌ๋ฆฐ)", "1:1 (์ •์‚ฌ๊ฐํ˜•)", "9:16 (์„ธ๋กœ ์˜์ƒ)", "4:3 (ํ‘œ์ค€)", "3:4 (์„ธ๋กœ ํ‘œ์ค€)"],
217
+ value="16:9 (์™€์ด๋“œ์Šคํฌ๋ฆฐ)"
218
+ )
219
+ img_camera_motion = gr.Dropdown(label="์นด๋ฉ”๋ผ ๋ชจ์…˜ (์นด๋ฉ”๋ผ ์›€์ง์ž„ ํšจ๊ณผ ์„ ํƒ)")
220
 
221
  img_generate_btn.click(
222
  image_to_video,
 
229
  motions = await get_camera_motions()
230
  return gr.update(choices=motions), gr.update(choices=motions)
231
  except Exception as e:
232
+ print(f"์นด๋ฉ”๋ผ ๋ชจ์…˜ ์—…๋ฐ์ดํŠธ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}")
233
  return gr.update(choices=[]), gr.update(choices=[])
234
 
235
  demo.load(update_camera_motions, outputs=[camera_motion, img_camera_motion])