Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -97,29 +97,7 @@ with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", fill_width=True, css=css) as demo:
|
|
97 |
image_files = gr.Files(label="Download", interactive=False)
|
98 |
clear_results = gr.Button("Clear Gallery / Download 🗑️", variant="secondary")
|
99 |
|
100 |
-
|
101 |
-
def extract_exif_data(image):
|
102 |
-
if image is None: return ""
|
103 |
-
try:
|
104 |
-
metadata_keys = ['parameters', 'metadata', 'prompt', 'Comment']
|
105 |
-
for key in metadata_keys:
|
106 |
-
if key in image.info:
|
107 |
-
return image.info[key]
|
108 |
-
return str(image.info)
|
109 |
-
except Exception as e:
|
110 |
-
return f"Error extracting metadata: {str(e)}"
|
111 |
-
with gr.Row():
|
112 |
-
with gr.Column():
|
113 |
-
image_metadata = gr.Image(label="Image with metadata", type="pil", sources=["upload"])
|
114 |
-
with gr.Column():
|
115 |
-
result_metadata = gr.Textbox(label="Metadata", show_label=True, show_copy_button=True, interactive=False, container=True, max_lines=99)
|
116 |
-
image_metadata.change(
|
117 |
-
fn=extract_exif_data,
|
118 |
-
inputs=[image_metadata],
|
119 |
-
outputs=[result_metadata],
|
120 |
-
)
|
121 |
-
gr.DuplicateButton(value="Duplicate Space")
|
122 |
-
|
123 |
#gr.on(triggers=[run_button.click, prompt.submit, random_button.click], fn=lambda: gr.update(interactive=True), inputs=None, outputs=stop_button, show_api=False)
|
124 |
model_name.change(change_model, [model_name], [model_info], queue=False, show_api=False)\
|
125 |
.success(warm_model, [model_name], None, queue=False, show_api=False)
|
|
|
97 |
image_files = gr.Files(label="Download", interactive=False)
|
98 |
clear_results = gr.Button("Clear Gallery / Download 🗑️", variant="secondary")
|
99 |
|
100 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
#gr.on(triggers=[run_button.click, prompt.submit, random_button.click], fn=lambda: gr.update(interactive=True), inputs=None, outputs=stop_button, show_api=False)
|
102 |
model_name.change(change_model, [model_name], [model_info], queue=False, show_api=False)\
|
103 |
.success(warm_model, [model_name], None, queue=False, show_api=False)
|