1 Star 4 Fork 2

Gitee 极速下载/anytext

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/tyxsspa/AnyText
克隆/下载
inference.py 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
tuoyuxiang 提交于 2024-04-18 18:27 . release train dataset and code
from modelscope.pipelines import pipeline
from util import save_images
pipe = pipeline('my-anytext-task', model='damo/cv_anytext_text_generation_editing', model_revision='v1.1.3')
img_save_folder = "SaveImages"
params = {
"show_debug": True,
"image_count": 2,
"ddim_steps": 20,
}
# 1. text generation
mode = 'text-generation'
input_data = {
"prompt": 'photo of caramel macchiato coffee on the table, top-down perspective, with "Any" "Text" written on it using cream',
"seed": 66273235,
"draw_pos": 'example_images/gen9.png'
}
results, rtn_code, rtn_warning, debug_info = pipe(input_data, mode=mode, **params)
if rtn_code >= 0:
save_images(results, img_save_folder)
print(f'Done, result images are saved in: {img_save_folder}')
if rtn_warning:
print(rtn_warning)
# 2. text editing
mode = 'text-editing'
input_data = {
"prompt": 'A cake with colorful characters that reads "EVERYDAY"',
"seed": 8943410,
"draw_pos": 'example_images/edit7.png',
"ori_image": 'example_images/ref7.jpg'
}
results, rtn_code, rtn_warning, debug_info = pipe(input_data, mode=mode, **params)
if rtn_code >= 0:
save_images(results, img_save_folder)
print(f'Done, result images are saved in: {img_save_folder}')
if rtn_warning:
print(rtn_warning)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mirrors/anytext.git
git@gitee.com:mirrors/anytext.git
mirrors
anytext
anytext
main

搜索帮助