Downloads · 30 days
0
Wangchuk1376/ThangkaModels
ThangkaModels is a image-to-image model from Wangchuk1376. Use it when you need one image transformed into another. It is set up for diffusers. The card lists the license as mit.
Downloads · 30 days
0
Access
Public
Updated Oct 22, 2025
Repo size
22.2 GB
Likes
1
Public
Click a slice to open those files.
.safetensors17 GB · 77%
From the Hugging Face model README
🎨 唐卡修复AI模型 / Thangka Restoration AI Models
</div>The Thangka Restoration AI Models are a collection of deep learning models specifically designed for Tibetan Buddhist Thangka art restoration. Built upon the latest Stable Diffusion 2.1 architecture and LoRA (Low-Rank Adaptation) fine-tuning technology, these models are meticulously trained on 1376 professionally annotated high-quality Thangka images.
Thangka, as an important art form of Tibetan Buddhism, carries profound religious and cultural significance, known as the "Encyclopedia of Tibet". However:
This project leverages AI technology to provide:
这是一套专门用于藏传佛教唐卡艺术修复的AI模型集合,基于Stable Diffusion 2.1和LoRA微调技术,在专业标注的唐卡图像上训练而成。
位于 models/finetuned_paddle/ 和 models/sd2.1_base_paddle/,这些是转换为PaddlePaddle格式的模型文件(.pdparams),可直接在PaddlePaddle框架中使用。
# Python版本
Python >= 3.9
# 核心依赖
paddlepaddle-gpu >= 2.6.0 # GPU版本 (推荐)
# 或
paddlepaddle >= 2.6.0 # CPU版本
# 其他依赖
pip install Pillow opencv-python numpy
import paddle
from PIL import Image
import numpy as np
# 这里是简化的示例,完整代码请参考GitHub仓库
# https://github.com/WangchukMind/thangka-restoration-ai
# 加载模型 (伪代码 - 实际使用请参考完整系统)
from diffusion_paddle import load_model, load_lora, inpaint
# 加载基础模型
pipe = load_model(
model_path="models/sd2.1_base_paddle",
device="gpu" # 或 "cpu"
)
# 加载LoRA模型
load_lora(pipe, "models/finetuned/thangka_21_Status_140.safetensors")
# 加载待修复图像
image = Image.open("damaged_thangka.png").resize((512, 512))
mask = Image.open("damage_mask.png").resize((512, 512))
# 执行修复
result = inpaint(
pipe=pipe,
image=image,
mask=mask,
prompt="traditional thangka art, Buddha, detailed, vibrant colors, gold outlines",
negative_prompt="low quality, blurry, distorted, modern style",
num_inference_steps=30,
guidance_scale=7.5,
strength=0.8
)
# 保存结果
result.save("restored_thangka.png")
# 加载ControlNet
from diffusion_paddle import load_controlnet
controlnet = load_controlnet("models/control_v11p_sd21_canny_paddle")
# 提取边缘
from skimage.feature import canny
edges = canny(np.array(image.convert('L')), sigma=1)
edge_image = Image.fromarray((edges * 255).astype(np.uint8))
# 使用ControlNet修复
result = inpaint_with_control(
pipe=pipe,
image=image,
mask=mask,
control_image=edge_image,
controlnet=controlnet,
prompt="traditional thangka art, detailed restoration",
num_inference_steps=30
)
完整的Web应用系统请访问GitHub:
# 克隆完整系统
git clone https://github.com/WangchukMind/thangka-restoration-ai.git
cd thangka-restoration-ai
# 安装依赖
cd Django
pip install -r requirements_paddle.txt
# 下载模型文件
# 模型文件较大,请从以下地址下载:
# Hugging Face: https://huggingface.co/Wangchuk1376/ThangkaModels
# 或参考 MODEL_DOWNLOAD.md
# 启动系统
python start_server.py runserver
# 或使用MVP简化版本
cd ..
python start_mvp_product.py
访问 http://localhost:3000 使用Web界面。
如果这个项目对您有帮助,请给我们一个⭐️!
🎨 Preserving millennium-old Thangka culture with AI technology!