arxivgpt kim commited on
Commit
abfd02c
Β·
verified Β·
1 Parent(s): adf1016

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -7
app.py CHANGED
@@ -7,7 +7,7 @@ import os
7
  API_KEY = os.getenv("API_KEY")
8
 
9
  # μ‹€μ œ API μ—”λ“œν¬μΈνŠΈ μ£Όμ†Œ
10
- api_url = "https://api.synclabs.so/video"
11
 
12
  def check_status_and_get_link(job_id):
13
  status_url = f"{api_url}/{job_id}"
@@ -35,7 +35,7 @@ def create_video(video_file_id, audio_file_id):
35
  "synergize": True,
36
  "maxCredits": None,
37
  "webhookUrl": None,
38
- "model": "sync-1"
39
  }
40
 
41
  headers = {"accept": "application/json", "x-api-key": API_KEY, "Content-Type": "application/json"}
@@ -45,9 +45,15 @@ def create_video(video_file_id, audio_file_id):
45
  job_id = response.json()["id"]
46
  download_url, message = check_status_and_get_link(job_id)
47
  if download_url:
48
- # HTML μ½”λ“œ 생성: λΉ„λ””μ˜€ μž„λ² λ“œ 및 λ‹€μš΄λ‘œλ“œ 링크
49
- html_code = f'<video width="640" height="360" controls><source src="{download_url}" type="video/mp4"></video><br><a href="{download_url}" target="_blank">λ‹€μš΄λ‘œλ“œ</a>'
50
- return job_id, html_code, message
 
 
 
 
 
 
51
  else:
52
  return job_id, "λΉ„λ””μ˜€ 링크λ₯Ό 뢈러올 수 μ—†μŠ΅λ‹ˆλ‹€.", message
53
  else:
@@ -55,8 +61,15 @@ def create_video(video_file_id, audio_file_id):
55
 
56
  iface = gr.Interface(
57
  fn=create_video,
58
- inputs=[gr.Textbox(label="λΉ„λ””μ˜€ 파일의 Google Drive ID"), gr.Textbox(label="μ˜€λ””μ˜€ 파일의 Google Drive ID")],
59
- outputs=[gr.Textbox(label="μž‘μ—… ID"), gr.HTML(label="λΉ„λ””μ˜€"), gr.Textbox(label="λ©”μ‹œμ§€")],
 
 
 
 
 
 
 
60
  description="Google Drive 곡유된 mp4 파일과 μ˜€λ””μ˜€ 파일의 IDλ₯Ό μž…λ ₯ν•˜μ—¬ λΉ„λ””μ˜€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€."
61
  )
62
 
 
7
  API_KEY = os.getenv("API_KEY")
8
 
9
  # μ‹€μ œ API μ—”λ“œν¬μΈνŠΈ μ£Όμ†Œ
10
+ api_url = os.getenv("api_url")
11
 
12
  def check_status_and_get_link(job_id):
13
  status_url = f"{api_url}/{job_id}"
 
35
  "synergize": True,
36
  "maxCredits": None,
37
  "webhookUrl": None,
38
+ "model": "sync-1.5.1-beta"
39
  }
40
 
41
  headers = {"accept": "application/json", "x-api-key": API_KEY, "Content-Type": "application/json"}
 
45
  job_id = response.json()["id"]
46
  download_url, message = check_status_and_get_link(job_id)
47
  if download_url:
48
+ # HTML μ½”λ“œ 생성: λΉ„λ””μ˜€ μž„λ² λ“œ 및 λ‹€μš΄λ‘œλ“œ λ²„νŠΌ
49
+ html_code = f'''
50
+ <video width="640" height="360" controls>
51
+ <source src="{download_url}" type="video/mp4">
52
+ </video>
53
+ <br>
54
+ <button onclick="window.location.href='{download_url}'">λ‹€μš΄λ‘œλ“œ</button>
55
+ '''
56
+ return job_id, html_code, "λΉ„λ””μ˜€κ°€ μ„±κ³΅μ μœΌλ‘œ μƒμ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€."
57
  else:
58
  return job_id, "λΉ„λ””μ˜€ 링크λ₯Ό 뢈러올 수 μ—†μŠ΅λ‹ˆλ‹€.", message
59
  else:
 
61
 
62
  iface = gr.Interface(
63
  fn=create_video,
64
+ inputs=[
65
+ gr.Textbox(label="λΉ„λ””μ˜€ 파일의 Google Drive ID"),
66
+ gr.Textbox(label="μ˜€λ””μ˜€ 파일의 Google Drive ID")
67
+ ],
68
+ outputs=[
69
+ gr.Textbox(label="μž‘μ—… ID"),
70
+ gr.HTML(label="λΉ„λ””μ˜€"),
71
+ gr.Textbox(label="λ©”μ‹œμ§€")
72
+ ],
73
  description="Google Drive 곡유된 mp4 파일과 μ˜€λ””μ˜€ 파일의 IDλ₯Ό μž…λ ₯ν•˜μ—¬ λΉ„λ””μ˜€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€."
74
  )
75