Spaces:
Sleeping
Sleeping
Siyun He
commited on
Commit
·
b0e8602
1
Parent(s):
ca13550
debug save
Browse files
app.py
CHANGED
|
@@ -300,8 +300,8 @@ def save_frame(frame):
|
|
| 300 |
# Save the frame to a temporary file
|
| 301 |
cv2.imwrite(filename, frame)
|
| 302 |
|
| 303 |
-
|
| 304 |
-
|
| 305 |
|
| 306 |
return filename
|
| 307 |
|
|
@@ -342,11 +342,12 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="purple", secondary_hue="blue"))
|
|
| 342 |
glass_shape_output = gr.Textbox(label="Recommended Glass Shape")
|
| 343 |
next_button = gr.Button("Next Glasses➡️")
|
| 344 |
save_button = gr.Button("Save as a Picture📌")
|
|
|
|
| 345 |
input_img.stream(webcam_input, [input_img, transform, lip_color], [input_img, face_shape_output, glass_shape_output], stream_every=0.1)
|
| 346 |
with gr.Row():
|
| 347 |
next_button.click(change_glasses, [], [])
|
| 348 |
with gr.Row():
|
| 349 |
-
save_button.click(save_frame, [input_img])
|
| 350 |
|
| 351 |
if __name__ == "__main__":
|
| 352 |
demo.launch(share=True)
|
|
|
|
| 300 |
# Save the frame to a temporary file
|
| 301 |
cv2.imwrite(filename, frame)
|
| 302 |
|
| 303 |
+
# # Refresh the interface
|
| 304 |
+
# refresh_interface()
|
| 305 |
|
| 306 |
return filename
|
| 307 |
|
|
|
|
| 342 |
glass_shape_output = gr.Textbox(label="Recommended Glass Shape")
|
| 343 |
next_button = gr.Button("Next Glasses➡️")
|
| 344 |
save_button = gr.Button("Save as a Picture📌")
|
| 345 |
+
download_link = gr.File(label="Download Saved Picture")
|
| 346 |
input_img.stream(webcam_input, [input_img, transform, lip_color], [input_img, face_shape_output, glass_shape_output], stream_every=0.1)
|
| 347 |
with gr.Row():
|
| 348 |
next_button.click(change_glasses, [], [])
|
| 349 |
with gr.Row():
|
| 350 |
+
save_button.click(save_frame, [input_img], [download_link])
|
| 351 |
|
| 352 |
if __name__ == "__main__":
|
| 353 |
demo.launch(share=True)
|