Spaces:
Running
on
Zero
Running
on
Zero
Update gradio_ui.py
Browse files- gradio_ui.py +11 -0
gradio_ui.py
CHANGED
|
@@ -2,6 +2,7 @@ import PIL
|
|
| 2 |
import torch
|
| 3 |
import subprocess
|
| 4 |
import gradio as gr
|
|
|
|
| 5 |
|
| 6 |
from typing import Optional
|
| 7 |
from accelerate import Accelerator
|
|
@@ -19,6 +20,16 @@ from huggingface_hub import hf_hub_download
|
|
| 19 |
from safetensors.torch import load_file
|
| 20 |
from clip_interrogator import Interrogator, Config, list_clip_models
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
def apply_color(image: PIL.Image.Image, color_map: PIL.Image.Image) -> PIL.Image.Image:
|
| 23 |
# Convert input images to LAB color space
|
| 24 |
image_lab = image.convert('LAB')
|
|
|
|
| 2 |
import torch
|
| 3 |
import subprocess
|
| 4 |
import gradio as gr
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
from typing import Optional
|
| 8 |
from accelerate import Accelerator
|
|
|
|
| 20 |
from safetensors.torch import load_file
|
| 21 |
from clip_interrogator import Interrogator, Config, list_clip_models
|
| 22 |
|
| 23 |
+
from huggingface_hub import snapshot_download
|
| 24 |
+
|
| 25 |
+
# Ensure 'checkpoint' directory exists
|
| 26 |
+
os.makedirs("sdxl_light_caption_output", exist_ok=True)
|
| 27 |
+
|
| 28 |
+
snapshot_download(
|
| 29 |
+
repo_id = 'nickpai/sdxl_light_caption_output',
|
| 30 |
+
local_dir = 'sdxl_light_caption_output'
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
def apply_color(image: PIL.Image.Image, color_map: PIL.Image.Image) -> PIL.Image.Image:
|
| 34 |
# Convert input images to LAB color space
|
| 35 |
image_lab = image.convert('LAB')
|