Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -81,11 +81,10 @@ def load_gallery():
|
|
81 |
if os.path.exists(GALLERY_JSON):
|
82 |
with open(GALLERY_JSON, "r") as f:
|
83 |
gallery = json.load(f)
|
84 |
-
return [(item["thumbnail"], item["prompt"]
|
85 |
return []
|
86 |
|
87 |
|
88 |
-
|
89 |
def respond(image, prompt, steps, cfg_scale, eta, fs, seed, video_length):
|
90 |
logging.info(f"Received prompt: {prompt}, steps: {steps}, cfg_scale: {cfg_scale}, "
|
91 |
f"eta: {eta}, fs: {fs}, seed: {seed}, video_length: {video_length}")
|
@@ -111,15 +110,16 @@ def respond(image, prompt, steps, cfg_scale, eta, fs, seed, video_length):
|
|
111 |
)
|
112 |
logging.info("API response received: %s", result)
|
113 |
|
114 |
-
|
|
|
115 |
if isinstance(result, dict) and 'video' in result:
|
116 |
-
saved_video_path = save_to_gallery(result['video'], prompt)
|
117 |
return saved_video_path
|
118 |
else:
|
119 |
-
raise ValueError("
|
120 |
except Exception as e:
|
121 |
-
logging.error("
|
122 |
-
return "
|
123 |
|
124 |
css = """
|
125 |
footer {
|
@@ -180,9 +180,9 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
|
|
180 |
selected_video = gr.Video(label="Selected Video")
|
181 |
refresh_btn = gr.Button("Refresh Gallery")
|
182 |
|
|
|
183 |
def update_gallery():
|
184 |
return load_gallery()
|
185 |
-
|
186 |
def show_video(evt: gr.SelectData):
|
187 |
return evt.value[2] # μ νλ μΈλ€μΌμ ν΄λΉνλ λΉλμ€ κ²½λ‘ λ°ν
|
188 |
|
|
|
81 |
if os.path.exists(GALLERY_JSON):
|
82 |
with open(GALLERY_JSON, "r") as f:
|
83 |
gallery = json.load(f)
|
84 |
+
return [(item["thumbnail"], item["prompt"]) for item in reversed(gallery)]
|
85 |
return []
|
86 |
|
87 |
|
|
|
88 |
def respond(image, prompt, steps, cfg_scale, eta, fs, seed, video_length):
|
89 |
logging.info(f"Received prompt: {prompt}, steps: {steps}, cfg_scale: {cfg_scale}, "
|
90 |
f"eta: {eta}, fs: {fs}, seed: {seed}, video_length: {video_length}")
|
|
|
110 |
)
|
111 |
logging.info("API response received: %s", result)
|
112 |
|
113 |
+
|
114 |
+
|
115 |
if isinstance(result, dict) and 'video' in result:
|
116 |
+
saved_video_path, _ = save_to_gallery(result['video'], prompt)
|
117 |
return saved_video_path
|
118 |
else:
|
119 |
+
raise ValueError("μμμΉ λͺ»ν API μλ΅ νμ")
|
120 |
except Exception as e:
|
121 |
+
logging.error("API μμ² μ€ μ€λ₯ λ°μ: %s", str(e))
|
122 |
+
return "μ€λ₯λ‘ μΈν΄ λΉλμ€ μμ±μ μ€ν¨νμ΅λλ€."
|
123 |
|
124 |
css = """
|
125 |
footer {
|
|
|
180 |
selected_video = gr.Video(label="Selected Video")
|
181 |
refresh_btn = gr.Button("Refresh Gallery")
|
182 |
|
183 |
+
|
184 |
def update_gallery():
|
185 |
return load_gallery()
|
|
|
186 |
def show_video(evt: gr.SelectData):
|
187 |
return evt.value[2] # μ νλ μΈλ€μΌμ ν΄λΉνλ λΉλμ€ κ²½λ‘ λ°ν
|
188 |
|