INNER CODE UNIT · Python

get_image_text_examples

OpenVGLab/OmniLottie · app.py:883

                def get_image_text_examples():
                    examples = []
                    demo_images_dir = "./example/demo_images"
                    if os.path.exists(demo_images_dir):
                        png_files = sorted([f for f in os.listdir(demo_images_dir) if f.endswith('.png')])
                        for png_file in png_files[:50]:  
                            base_name = os.path.splitext(png_file)[0]
                            txt_file = os.path.join(demo_images_dir, f"{base_name}.txt")
                            png_path = os.path.join(demo_images_dir, png_file)
                            if os.path.exists(txt_file):
                                with open(txt_file, 'r', encoding='utf-8') as f:
                                    text_desc = f.read().strip()
                                examples.append([png_path, text_desc])
                    return examples

                gr.Examples(
                    examples=get_image_text_examples(),
                    inputs=[image_input, image_text_input],

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…