mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-01-08 17:50:13 +01:00
Make it possible to upload images to the UI to see settings
This commit is contained in:
parent
f41e558e00
commit
977d08de14
|
|
@ -330,6 +330,15 @@ def send_to_generate(selected_image_path):
|
|||
return updates + [status]
|
||||
|
||||
|
||||
def read_dropped_image_metadata(image_path):
|
||||
"""Read metadata from a dropped/uploaded image."""
|
||||
if not image_path:
|
||||
return "Drop an image to view its generation settings."
|
||||
|
||||
metadata = read_image_metadata(image_path)
|
||||
return format_metadata_for_display(metadata)
|
||||
|
||||
|
||||
def create_ui():
|
||||
if shared.settings['image_model_menu'] != 'None':
|
||||
shared.image_model_name = shared.settings['image_model_menu']
|
||||
|
|
@ -429,6 +438,13 @@ def create_ui():
|
|||
shared.gradio['image_send_to_generate'] = gr.Button("Send to Generate", variant="primary")
|
||||
shared.gradio['image_gallery_status'] = gr.Markdown("")
|
||||
|
||||
gr.Markdown("### Import Image")
|
||||
shared.gradio['image_drop_upload'] = gr.Image(
|
||||
label="Drop image here to view settings",
|
||||
type="filepath",
|
||||
height=150
|
||||
)
|
||||
|
||||
# TAB 3: MODEL
|
||||
with gr.TabItem("Model"):
|
||||
with gr.Row():
|
||||
|
|
@ -630,6 +646,13 @@ def create_event_handlers():
|
|||
show_progress=False
|
||||
)
|
||||
|
||||
shared.gradio['image_drop_upload'].change(
|
||||
read_dropped_image_metadata,
|
||||
gradio('image_drop_upload'),
|
||||
gradio('image_settings_display'),
|
||||
show_progress=False
|
||||
)
|
||||
|
||||
|
||||
def generate(state):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue