Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372import gradio as grimport torchfrom diffusers import FluxFillPipelinefrom diffusers.utils import load_imagefrom PIL import Image, ImageDrawimport numpy as npimport spacesfrom huggingface_hub import hf_hub_downloadpipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev",torch_dtype=torch.bfloat16).to("cuda")def can_expand(source_width, source_height, target_width, target_height, alignment):if alignment in ("Left", "Right") and source_width >= target_width:return Falseif alignment in ("Top", "Bottom") and source_height >= target_height:return Falsereturn Truedef prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom):target_size = (width, height)scale_factor = min(target_size[0] / image.width, target_size[1] / image.height)new_width = int(image.width * scale_factor)new_height = int(image.height * scale_factor)source = image.resize((new_width, new_height), Image.LANCZOS)if resize_option == "Full":resize_percentage = 100elif resize_option == "75%":resize_percentage = 75elif resize_option == "50%":resize_percentage = 50elif resize_option == "33%":resize_percentage = 33elif resize_option == "25%":resize_percentage = 25else: # Customresize_percentage = custom_resize_percentage# Calculate new dimensions based on percentageresize_factor = resize_percentage / 100new_width = int(source.width * resize_factor)new_height = int(source.height * resize_factor)# Ensure minimum size of 64 pixelsnew_width = max(new_width, 64)new_height = max(new_height, 64)# Resize the imagesource = source.resize((new_width, new_height), Image.LANCZOS)# Calculate the overlap in pixels based on the percentageoverlap_x = int(new_width * (overlap_percentage / 100))overlap_y = int(new_height * (overlap_percentage / 100))# Ensure minimum overlap of 1 pixeloverlap_x = max(overlap_x, 1)overlap_y = max(overlap_y, 1)# Calculate margins based on alignmentif alignment == "Middle":margin_x = (target_size[0] - new_width) // 2margin_y = (target_size[1] - new_height) // 2elif alignment == "Left":margin_x = 0margin_y = (target_size[1] - new_height) // 2elif alignment == "Right":margin_x = target_size[0] - new_widthmargin_y = (target_size[1] - new_height) // 2elif alignment == "Top":margin_x = (target_size[0] - new_width) // 2margin_y = 0elif alignment == "Bottom":margin_x = (target_size[0] - new_width) // 2margin_y = target_size[1] - new_height# Adjust margins to eliminate gapsmargin_x = max(0, min(margin_x, target_size[0] - new_width))margin_y = max(0, min(margin_y, target_size[1] - new_height))# Create a new background image and paste the resized source imagebackground = Image.new('RGB', target_size, (255, 255, 255))background.paste(source, (margin_x, margin_y))# Create the maskmask = Image.new('L', target_size, 255)mask_draw = ImageDraw.Draw(mask)# Calculate overlap areaswhite_gaps_patch = 2left_overlap = margin_x + overlap_x if overlap_left else margin_x + white_gaps_patchright_overlap = margin_x + new_width - overlap_x if overlap_right else margin_x + new_width - white_gaps_patchtop_overlap = margin_y + overlap_y if overlap_top else margin_y + white_gaps_patchbottom_overlap = margin_y + new_height - overlap_y if overlap_bottom else margin_y + new_height - white_gaps_patchif alignment == "Left":left_overlap = margin_x + overlap_x if overlap_left else margin_xelif alignment == "Right":right_overlap = margin_x + new_width - overlap_x if overlap_right else margin_x + new_widthelif alignment == "Top":top_overlap = margin_y + overlap_y if overlap_top else margin_yelif alignment == "Bottom":bottom_overlap = margin_y + new_height - overlap_y if overlap_bottom else margin_y + new_height# Draw the maskmask_draw.rectangle([(left_overlap, top_overlap),(right_overlap, bottom_overlap)], fill=0)return background, mask@spaces.GPUdef inpaint(image, width, height, overlap_percentage, num_inference_steps, resize_option, custom_resize_percentage, prompt_input, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom, progress=gr.Progress(track_tqdm=True)):background, mask = prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom)if not can_expand(background.width, background.height, width, height, alignment):alignment = "Middle"cnet_image = background.copy()cnet_image.paste(0, (0, 0), mask)final_prompt = prompt_input#generator = torch.Generator(device="cuda").manual_seed(42)result = pipe(prompt=final_prompt,height=height,width=width,image=cnet_image,mask_image=mask,num_inference_steps=num_inference_steps,guidance_scale=30,).images[0]result = result.convert("RGBA")cnet_image.paste(result, (0, 0), mask)return cnet_image, backgrounddef preview_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom):background, mask = prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom)preview = background.copy().convert('RGBA')red_overlay = Image.new('RGBA', background.size, (255, 0, 0, 64))red_mask = Image.new('RGBA', background.size, (0, 0, 0, 0))red_mask.paste(red_overlay, (0, 0), mask)preview = Image.alpha_composite(preview, red_mask)return previewdef clear_result():return gr.update(value=None)def preload_presets(target_ratio, ui_width, ui_height):if target_ratio == "9:16":return 720, 1280, gr.update()elif target_ratio == "16:9":return 1280, 720, gr.update()elif target_ratio == "1:1":return 1024, 1024, gr.update()elif target_ratio == "Custom":return ui_width, ui_height, gr.update(open=True)def select_the_right_preset(user_width, user_height):if user_width == 720 and user_height == 1280:return "9:16"elif user_width == 1280 and user_height == 720:return "16:9"elif user_width == 1024 and user_height == 1024:return "1:1"else:return "Custom"def toggle_custom_resize_slider(resize_option):return gr.update(visible=(resize_option == "Custom"))def update_history(new_image, history):if history is None:history = []history.insert(0, new_image)return historycss = """.gradio-container {max-width: 1250px !important;}"""title = """<h1 align="center">Flux Outpaint Dev 🤩</h1>"""with gr.Blocks(css=css) as demo:with gr.Column():gr.HTML(title)with gr.Row():with gr.Column():input_image = gr.Image(type="pil",label="Input Image")with gr.Row():with gr.Column(scale=2):prompt_input = gr.Textbox(label="Prompt (Optional)")with gr.Column(scale=1):run_button = gr.Button("Generate")with gr.Row():target_ratio = gr.Radio(label="Image Ratio",choices=["9:16", "16:9", "1:1", "Custom"],value="9:16",scale=3)alignment_dropdown = gr.Dropdown(choices=["Middle", "Left", "Right", "Top", "Bottom"],value="Middle",label="Alignment",)resize_option = gr.Radio(label="Resize input image",choices=["Full", "75%", "50%", "33%", "25%", "Custom"],value="75%")custom_resize_percentage = gr.Slider(label="Custom resize (%)",minimum=1,maximum=100,step=1,value=50,visible=False)with gr.Accordion(label="Advanced settings", open=False) as settings_panel:with gr.Column():with gr.Row():width_slider = gr.Slider(label="Target Width",minimum=720,maximum=1536,step=8,value=720,)height_slider = gr.Slider(label="Target Height",minimum=720,maximum=1536,step=8,value=1280,)num_inference_steps = gr.Slider(label="Steps", minimum=2, maximum=50, step=1, value=28)with gr.Group():overlap_percentage = gr.Slider(label="Mask overlap (%)",minimum=1,maximum=50,value=10,step=1)with gr.Row():overlap_top = gr.Checkbox(label="Overlap Top", value=True)overlap_right = gr.Checkbox(label="Overlap Right", value=True)with gr.Row():overlap_left = gr.Checkbox(label="Overlap Left", value=True)overlap_bottom = gr.Checkbox(label="Overlap Bottom", value=True)with gr.Column():preview_button = gr.Button("Preview alignment and mask")with gr.Column():result = gr.Image(interactive=False,label="Generated Image",)use_as_input_button = gr.Button("Use as Input Image", visible=False)with gr.Accordion("History and Mask", open=False):history_gallery = gr.Gallery(label="History", columns=6, object_fit="contain", interactive=False)preview_image = gr.Image(label="Mask preview")def use_output_as_input(output_image):return output_imageuse_as_input_button.click(fn=use_output_as_input,inputs=[result],outputs=[input_image])target_ratio.change(fn=preload_presets,inputs=[target_ratio, width_slider, height_slider],outputs=[width_slider, height_slider, settings_panel],queue=False)width_slider.change(fn=select_the_right_preset,inputs=[width_slider, height_slider],outputs=[target_ratio],queue=False)height_slider.change(fn=select_the_right_preset,inputs=[width_slider, height_slider],outputs=[target_ratio],queue=False)resize_option.change(fn=toggle_custom_resize_slider,inputs=[resize_option],outputs=[custom_resize_percentage],queue=False)run_button.click(fn=clear_result,inputs=None,outputs=result,).then(fn=inpaint,inputs=[input_image, width_slider, height_slider, overlap_percentage, num_inference_steps,resize_option, custom_resize_percentage, prompt_input, alignment_dropdown,overlap_left, overlap_right, overlap_top, overlap_bottom],outputs=[result, preview_image],).then(fn=lambda x, history: update_history(x, history),inputs=[result, history_gallery],outputs=history_gallery,).then(fn=lambda: gr.update(visible=True),inputs=None,outputs=use_as_input_button,)prompt_input.submit(fn=clear_result,inputs=None,outputs=result,).then(fn=inpaint,inputs=[input_image, width_slider, height_slider, overlap_percentage, num_inference_steps, resize_option, custom_resize_percentage, prompt_input, alignment_dropdown,overlap_left, overlap_right, overlap_top, overlap_bottom],outputs=[result, preview_image],).then(fn=lambda x, history: update_history(x, history),inputs=[result, history_gallery],outputs=history_gallery,).then(fn=lambda: gr.update(visible=True),inputs=None,outputs=use_as_input_button,)preview_button.click(fn=preview_image_and_mask,inputs=[input_image, width_slider, height_slider, overlap_percentage, resize_option, custom_resize_percentage, alignment_dropdown,overlap_left, overlap_right, overlap_top, overlap_bottom],outputs=preview_image,queue=False)demo.queue(max_size=12).launch(share=False)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368import osimport randomimport uuidimport jsonimport timeimport asyncioimport refrom threading import Threadimport gradio as grimport spacesimport torchimport numpy as npfrom PIL import Imageimport edge_ttsfrom transformers import (AutoModelForCausalLM,AutoTokenizer,TextIteratorStreamer,Qwen2VLForConditionalGeneration,AutoProcessor,)from transformers.image_utils import load_imagefrom diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteSchedulerDESCRIPTION = """# SDXL LoRA DLC 🎃"""css = '''h1 {text-align: center;display: block;}#duplicate-button {margin: auto;color: #fff;background: #1565c0;border-radius: 100vh;}'''MAX_MAX_NEW_TOKENS = 2048DEFAULT_MAX_NEW_TOKENS = 1024MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")# -----------------------# Progress Bar Helper# -----------------------def progress_bar_html(label: str) -> str:"""Returns an HTML snippet for a thin progress bar with a label.The progress bar is styled as a dark red animated bar."""return f'''<div style="display: flex; align-items: center;"><span style="margin-right: 10px; font-size: 14px;">{label}</span><div style="width: 110px; height: 5px; background-color: #DDA0DD; border-radius: 2px; overflow: hidden;"><div style="width: 100%; height: 100%; background-color: #FF00FF; animation: loading 1.5s linear infinite;"></div></div></div><style>@keyframes loading {{0% {{ transform: translateX(-100%); }}100% {{ transform: translateX(100%); }}}}</style>'''# -----------------------# Text Generation Setup# -----------------------model_id = "prithivMLmods/FastThink-0.5B-Tiny"tokenizer = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained(model_id,device_map="auto",torch_dtype=torch.bfloat16,)model.eval()TTS_VOICES = ["en-US-JennyNeural", # @tts1"en-US-GuyNeural", # @tts2]# -----------------------# Multimodal OCR Setup# -----------------------MODEL_ID = "prithivMLmods/Qwen2-VL-OCR2-2B-Instruct"processor = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True)model_m = Qwen2VLForConditionalGeneration.from_pretrained(MODEL_ID,trust_remote_code=True,torch_dtype=torch.float16).to("cuda").eval()async def text_to_speech(text: str, voice: str, output_file="output.mp3"):"""Convert text to speech using Edge TTS and save as MP3"""communicate = edge_tts.Communicate(text, voice)await communicate.save(output_file)return output_filedef clean_chat_history(chat_history):"""Filter out any chat entries whose "content" is not a string."""cleaned = []for msg in chat_history:if isinstance(msg, dict) and isinstance(msg.get("content"), str):cleaned.append(msg)return cleaned# -----------------------# Stable Diffusion Image Generation Setup# -----------------------MAX_SEED = np.iinfo(np.int32).maxUSE_TORCH_COMPILE = FalseENABLE_CPU_OFFLOAD = Falseif torch.cuda.is_available():pipe = StableDiffusionXLPipeline.from_pretrained("SG161222/RealVisXL_V4.0_Lightning",torch_dtype=torch.float16,use_safetensors=True,)pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)# LoRA options with one example for each.LORA_OPTIONS = {"Realism": ("prithivMLmods/Canopus-Realism-LoRA", "Canopus-Realism-LoRA.safetensors", "rlms"),"Pixar": ("prithivMLmods/Canopus-Pixar-Art", "Canopus-Pixar-Art.safetensors", "pixar"),"Photoshoot": ("prithivMLmods/Canopus-Photo-Shoot-Mini-LoRA", "Canopus-Photo-Shoot-Mini-LoRA.safetensors", "photo"),"Clothing": ("prithivMLmods/Canopus-Clothing-Adp-LoRA", "Canopus-Dress-Clothing-LoRA.safetensors", "clth"),"Interior": ("prithivMLmods/Canopus-Interior-Architecture-0.1", "Canopus-Interior-Architecture-0.1δ.safetensors", "arch"),"Fashion": ("prithivMLmods/Canopus-Fashion-Product-Dilation", "Canopus-Fashion-Product-Dilation.safetensors", "fashion"),"Minimalistic": ("prithivMLmods/Pegasi-Minimalist-Image-Style", "Pegasi-Minimalist-Image-Style.safetensors", "minimalist"),"Modern": ("prithivMLmods/Canopus-Modern-Clothing-Design", "Canopus-Modern-Clothing-Design.safetensors", "mdrnclth"),"Animaliea": ("prithivMLmods/Canopus-Animaliea-Artism", "Canopus-Animaliea-Artism.safetensors", "Animaliea"),"Wallpaper": ("prithivMLmods/Canopus-Liquid-Wallpaper-Art", "Canopus-Liquid-Wallpaper-Minimalize-LoRA.safetensors", "liquid"),"Cars": ("prithivMLmods/Canes-Cars-Model-LoRA", "Canes-Cars-Model-LoRA.safetensors", "car"),"PencilArt": ("prithivMLmods/Canopus-Pencil-Art-LoRA", "Canopus-Pencil-Art-LoRA.safetensors", "Pencil Art"),"ArtMinimalistic": ("prithivMLmods/Canopus-Art-Medium-LoRA", "Canopus-Art-Medium-LoRA.safetensors", "mdm"),}# Load all LoRA weightsfor model_name, weight_name, adapter_name in LORA_OPTIONS.values():pipe.load_lora_weights(model_name, weight_name=weight_name, adapter_name=adapter_name)pipe.to("cuda")else:pipe = StableDiffusionXLPipeline.from_pretrained("SG161222/RealVisXL_V4.0_Lightning",torch_dtype=torch.float32,use_safetensors=True,).to(device)def save_image(img: Image.Image) -> str:"""Save a PIL image with a unique filename and return the path."""unique_name = str(uuid.uuid4()) + ".png"img.save(unique_name)return unique_namedef randomize_seed_fn(seed: int, randomize_seed: bool) -> int:if randomize_seed:seed = random.randint(0, MAX_SEED)return seed@spaces.GPU(duration=180, enable_queue=True)def generate_image(prompt: str,negative_prompt: str = "",seed: int = 0,width: int = 1024,height: int = 1024,guidance_scale: float = 3.0,randomize_seed: bool = True,lora_model: str = "Realism",progress=gr.Progress(track_tqdm=True),):seed = int(randomize_seed_fn(seed, randomize_seed))effective_negative_prompt = negative_prompt # Use provided negative prompt if anymodel_name, weight_name, adapter_name = LORA_OPTIONS[lora_model]pipe.set_adapters(adapter_name)outputs = pipe(prompt=prompt,negative_prompt=effective_negative_prompt,width=width,height=height,guidance_scale=guidance_scale,num_inference_steps=28,num_images_per_prompt=1,cross_attention_kwargs={"scale": 0.65},output_type="pil",)images = outputs.imagesimage_paths = [save_image(img) for img in images]return image_paths, seed# -----------------------# Main Chat/Generation Function# -----------------------@spaces.GPUdef generate(input_dict: dict,chat_history: list[dict],max_new_tokens: int = 1024,temperature: float = 0.6,top_p: float = 0.9,top_k: int = 50,repetition_penalty: float = 1.2,):"""Generates chatbot responses with support for multimodal input, TTS, and image generation.Special commands:- "@tts1" or "@tts2": triggers text-to-speech.- "@<lora_command>": triggers image generation using the new LoRA pipeline.Available commands (case-insensitive): @realism, @pixar, @photoshoot, @clothing, @interior, @fashion,@minimalistic, @modern, @animaliea, @wallpaper, @cars, @pencilart, @artminimalistic."""text = input_dict["text"]files = input_dict.get("files", [])# Check for image generation command based on LoRA tags.lora_mapping = { key.lower(): key for key in LORA_OPTIONS }for key_lower, key in lora_mapping.items():command_tag = "@" + key_lowerif text.strip().lower().startswith(command_tag):prompt_text = text.strip()[len(command_tag):].strip()yield progress_bar_html(f"Processing Image Generation ({key} style)")image_paths, used_seed = generate_image(prompt=prompt_text,negative_prompt="",seed=1,width=1024,height=1024,guidance_scale=3,randomize_seed=True,lora_model=key,)yield progress_bar_html("Finalizing Image Generation")yield gr.Image(image_paths[0])return# Check for TTS command (@tts1 or @tts2)tts_prefix = "@tts"is_tts = any(text.strip().lower().startswith(f"{tts_prefix}{i}") for i in range(1, 3))voice_index = next((i for i in range(1, 3) if text.strip().lower().startswith(f"{tts_prefix}{i}")), None)if is_tts and voice_index:voice = TTS_VOICES[voice_index - 1]text = text.replace(f"{tts_prefix}{voice_index}", "").strip()conversation = [{"role": "user", "content": text}]else:voice = Nonetext = text.replace(tts_prefix, "").strip()conversation = clean_chat_history(chat_history)conversation.append({"role": "user", "content": text})if files:if len(files) > 1:images = [load_image(image) for image in files]elif len(files) == 1:images = [load_image(files[0])]else:images = []messages = [{"role": "user","content": [*[{"type": "image", "image": image} for image in images],{"type": "text", "text": text},]}]prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)inputs = processor(text=[prompt], images=images, return_tensors="pt", padding=True).to("cuda")streamer = TextIteratorStreamer(processor, skip_prompt=True, skip_special_tokens=True)generation_kwargs = {**inputs, "streamer": streamer, "max_new_tokens": max_new_tokens}thread = Thread(target=model_m.generate, kwargs=generation_kwargs)thread.start()buffer = ""yield progress_bar_html("Processing with Qwen2VL Ocr")for new_text in streamer:buffer += new_textbuffer = buffer.replace("<|im_end|>", "")time.sleep(0.01)yield bufferelse:input_ids = tokenizer.apply_chat_template(conversation, add_generation_prompt=True, return_tensors="pt")if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")input_ids = input_ids.to(model.device)streamer = TextIteratorStreamer(tokenizer, timeout=20.0, skip_prompt=True, skip_special_tokens=True)generation_kwargs = {"input_ids": input_ids,"streamer": streamer,"max_new_tokens": max_new_tokens,"do_sample": True,"top_p": top_p,"top_k": top_k,"temperature": temperature,"num_beams": 1,"repetition_penalty": repetition_penalty,}t = Thread(target=model.generate, kwargs=generation_kwargs)t.start()outputs = []for new_text in streamer:outputs.append(new_text)yield "".join(outputs)final_response = "".join(outputs)yield final_responseif is_tts and voice:output_file = asyncio.run(text_to_speech(final_response, voice))yield gr.Audio(output_file, autoplay=True)# -----------------------# Gradio Chat Interface# -----------------------demo = gr.ChatInterface(fn=generate,additional_inputs=[gr.Slider(label="Max new tokens", minimum=1, maximum=MAX_MAX_NEW_TOKENS, step=1, value=DEFAULT_MAX_NEW_TOKENS),gr.Slider(label="Temperature", minimum=0.1, maximum=4.0, step=0.1, value=0.6),gr.Slider(label="Top-p (nucleus sampling)", minimum=0.05, maximum=1.0, step=0.05, value=0.9),gr.Slider(label="Top-k", minimum=1, maximum=1000, step=1, value=50),gr.Slider(label="Repetition penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.2),],examples=[['@realism Chocolate dripping from a donut against a yellow background, in the style of brocore, hyper-realistic'],["@pixar A young man with light brown wavy hair and light brown eyes sitting in an armchair and looking directly at the camera, pixar style, disney pixar, office background, ultra detailed, 1 man"],["@realism A futuristic cityscape with neon lights"],["@photoshoot A portrait of a person with dramatic lighting"],[{"text": "summarize the letter", "files": ["examples/1.png"]}],["Python Program for Array Rotation"],["@tts1 Who is Nikola Tesla, and why did he die?"],["@clothing Fashionable streetwear in an urban environment"],["@interior A modern living room interior with minimalist design"],["@fashion A runway model in haute couture"],["@minimalistic A simple and elegant design of a serene landscape"],["@modern A contemporary art piece with abstract geometric shapes"],["@animaliea A cute animal portrait with vibrant colors"],["@wallpaper A scenic mountain range perfect for a desktop wallpaper"],["@cars A sleek sports car cruising on a city street"],["@pencilart A detailed pencil sketch of a historic building"],["@artminimalistic An artistic minimalist composition with subtle tones"],["@tts2 What causes rainbows to form?"],],cache_examples=False,type="messages",description=DESCRIPTION,css=css,fill_height=True,textbox=gr.MultimodalTextbox(label="Query Input", file_types=["image"], file_count="multiple", placeholder="default [text, vision] , scroll down examples to explore more art styles"),stop_btn="Stop Generation",multimodal=True,)if __name__ == "__main__":demo.queue(max_size=20).launch(ssr_mode=False, share=True)
app.py+355-359