import json from typing import List import spaces import gradio as gr from huggingface_hub import ModelCard from modules.helpers.common_helpers import ControlNetReq, BaseReq, BaseImg2ImgReq, BaseInpaintReq from modules.helpers.flux_helpers import gen_img from config import flux_loras loras = flux_loras # Event functions def update_fast_generation(fast_generation): if fast_generation: return ( gr.update( value=3.5 ), gr.update( value=8 ) ) def selected_lora_from_gallery(evt: gr.SelectData): return ( gr.update( value=evt.index ) ) def update_selected_lora(custom_lora): link = custom_lora.split("/") if len(link) == 2: model_card = ModelCard.load(custom_lora) trigger_word = model_card.data.get("instance_prompt", "") image_url = f"""https://huggingface.co/{custom_lora}/resolve/main/{model_card.data.get("widget", [{}])[0].get("output", {}).get("url", None)}""" custom_lora_info_css = """ """ custom_lora_info_html = f"""