Spaces:
Runtime error
Runtime error
Download run.py from mr2along/upload_file_limit_test: direct link, hf CLI and curl.
- Browser
- Download file 999 Bytes
-
https://huggingface.co/spaces/mr2along/upload_file_limit_test/resolve/main/run.py
- Command line
-
hf download hf://spaces/mr2along/upload_file_limit_test/run.py
-
curl -L -o run.py https://huggingface.co/spaces/mr2along/upload_file_limit_test/resolve/main/run.py
999 Bytes
| 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() | |