import os os.system("pip install git+https://github.com/modelscope/modelscope.git@refs/pull/173/head") import gradio as gr import cv2 from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks text2image = pipeline(Tasks.text_to_image_synthesis,"damo/cv_diffusion_text-to-image-synthesis_tiny") def inference(text): result = text2image({'text': '中国山水画', "sampler": ddim}) cv2.imwrite("result.png", result["output_imgs"][0]) return "result.png" title = "Text to Image Generative Diffusion Model - Chinese and English - General Domain - tiny" gr.Interface(inference, "text","image", title=title).launch()