Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -180,24 +180,31 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
|
|
180 |
|
181 |
|
182 |
with gr.Tab("Gallery"):
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
selected_video = gr.Video(label="Selected Video")
|
185 |
refresh_btn = gr.Button("Refresh Gallery")
|
186 |
|
187 |
def update_gallery():
|
188 |
gallery_items = load_gallery()
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
return html
|
194 |
|
195 |
def show_video(evt: gr.SelectData):
|
196 |
-
return evt.
|
197 |
|
198 |
-
refresh_btn.click(fn=update_gallery, inputs=None, outputs=
|
199 |
-
demo.load(fn=update_gallery, inputs=None, outputs=
|
200 |
-
|
201 |
|
202 |
input_text.submit(
|
203 |
fn=respond,
|
@@ -206,9 +213,8 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
|
|
206 |
).then(
|
207 |
fn=update_gallery,
|
208 |
inputs=None,
|
209 |
-
outputs=
|
210 |
)
|
211 |
|
212 |
if __name__ == "__main__":
|
213 |
demo.launch()
|
214 |
-
|
|
|
180 |
|
181 |
|
182 |
with gr.Tab("Gallery"):
|
183 |
+
gallery = gr.Gallery(
|
184 |
+
label="Generated Videos",
|
185 |
+
show_label=False,
|
186 |
+
elem_id="gallery",
|
187 |
+
columns=[5],
|
188 |
+
rows=[3],
|
189 |
+
object_fit="contain",
|
190 |
+
height="auto"
|
191 |
+
)
|
192 |
selected_video = gr.Video(label="Selected Video")
|
193 |
refresh_btn = gr.Button("Refresh Gallery")
|
194 |
|
195 |
def update_gallery():
|
196 |
gallery_items = load_gallery()
|
197 |
+
return [
|
198 |
+
(item['image'], item['caption'])
|
199 |
+
for item in gallery_items
|
200 |
+
]
|
|
|
201 |
|
202 |
def show_video(evt: gr.SelectData):
|
203 |
+
return evt.value[0] # 선택된 비디오의 경로 반환
|
204 |
|
205 |
+
refresh_btn.click(fn=update_gallery, inputs=None, outputs=gallery)
|
206 |
+
demo.load(fn=update_gallery, inputs=None, outputs=gallery)
|
207 |
+
gallery.select(show_video, None, selected_video)
|
208 |
|
209 |
input_text.submit(
|
210 |
fn=respond,
|
|
|
213 |
).then(
|
214 |
fn=update_gallery,
|
215 |
inputs=None,
|
216 |
+
outputs=gallery
|
217 |
)
|
218 |
|
219 |
if __name__ == "__main__":
|
220 |
demo.launch()
|
|