Update app.py
Browse files186 unmodified lines1871881891901911921936 unmodified lines200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230186 unmodified lineswith torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16), timer("inference"):try:generated_image = pipe(prompt=[formatted_prompt], # 수정된 프롬프트 사용generator=torch.Generator().manual_seed(int(seed)),num_inference_steps=int(steps),guidance_scale=float(scales),6 unmodified linesif saved_path is None:print("Warning: Failed to save generated image")return generated_image, load_gallery()except Exception as e:print(f"Error in image generation: {str(e)}")return None, load_gallery()def update_seed():return get_random_seed()generate_btn.click(process_and_save_image,inputs=[height, width, steps, scales, prompt, seed],outputs=[output, gallery])randomize_seed.click(update_seed,outputs=[seed])generate_btn.click(update_seed,outputs=[seed])if __name__ == "__main__":demo.launch(allowed_paths=[PERSISTENT_DIR])186 unmodified lines1871881891901911921936 unmodified lines200201202203204205206207208209210211212213186 unmodified lineswith torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16), timer("inference"):try:generated_image = pipe(prompt=[formatted_prompt],generator=torch.Generator().manual_seed(int(seed)),num_inference_steps=int(steps),guidance_scale=float(scales),6 unmodified linesif saved_path is None:print("Warning: Failed to save generated image")return generated_imageexcept Exception as e:print(f"Error in image generation: {str(e)}")return Nonedef update_seed():return get_random_seed()generate_btn.click(process_and_save_image,inputs=[height, width, steps, scales, prompt, seed],
app.py+4-21