akhaliq's picture
akhaliq HF staff
minor improv speedup build (#1)
d853533
raw
history blame
600 Bytes
import os
# os.system("""pip install "modelscope[multi-modal]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html""")
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/multi-modal_chinese_stable_diffusion_v1.0")
def inference(text):
result = text2image({"text":text})
cv2.imwrite("result.png", result["output_imgs"][0])
return "result.png"
title = "chinese stable diffusion"
gr.Interface(inference, "text","image", title=title).launch()