Spaces:
Runtime error
Runtime error
File size: 999 Bytes
1850628 108033f 1850628 108033f 1850628 108033f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import gradio as gr
from PIL import Image
import torch
from transformers import AutoModel, AutoTokenizer
# Tải mô hình Kanbara
model_name = "Kanbara/doll-likeness-series"
model = AutoModel.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
def generate_image(source_img, target_img):
# Tiền xử lý hình ảnh
source_image = Image.open(source_img).convert("RGB")
target_image = Image.open(target_img).convert("RGB")
# Chuyển đổi hình ảnh sang tensor và tạo đầu ra
# (Thêm mã xử lý ở đây để tạo hình ảnh)
# Giả lập đầu ra để hiển thị
output_image = source_image # Đây chỉ là một ví dụ
return output_image
# Tạo giao diện Gradio
iface = gr.Interface(fn=generate_image,
inputs=["image", "image"],
outputs="image",
title="Tạo Hình Ảnh từ Hình Ảnh Nguồn và Mục Tiêu")
iface.launch()
|