Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ import subprocess
|
|
20 |
import torch
|
21 |
import gradio as gr
|
22 |
import string
|
23 |
-
import random, time,
|
24 |
|
25 |
from src.flux.generate import generate_from_test_sample, seed_everything
|
26 |
from src.flux.pipeline_tools import CustomFluxPipeline, load_modulation_adapter, load_dit_lora
|
@@ -30,7 +30,59 @@ from eval.tools.florence_sam import ObjectDetector
|
|
30 |
import shutil
|
31 |
import yaml
|
32 |
import numpy as np
|
33 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
dtype = torch.bfloat16
|
36 |
device = "cuda"
|
|
|
20 |
import torch
|
21 |
import gradio as gr
|
22 |
import string
|
23 |
+
import random, time, math
|
24 |
|
25 |
from src.flux.generate import generate_from_test_sample, seed_everything
|
26 |
from src.flux.pipeline_tools import CustomFluxPipeline, load_modulation_adapter, load_dit_lora
|
|
|
30 |
import shutil
|
31 |
import yaml
|
32 |
import numpy as np
|
33 |
+
from huggingface_hub import snapshot_download
|
34 |
+
import os
|
35 |
+
|
36 |
+
# FLUX.1-dev
|
37 |
+
snapshot_download(
|
38 |
+
repo_id="black-forest-labs/FLUX.1-dev",
|
39 |
+
local_dir="./FLUX.1-dev",
|
40 |
+
local_dir_use_symlinks=False
|
41 |
+
)
|
42 |
+
|
43 |
+
# Florence-2-large
|
44 |
+
snapshot_download(
|
45 |
+
repo_id="microsoft/Florence-2-large",
|
46 |
+
local_dir="./Florence-2-large",
|
47 |
+
local_dir_use_symlinks=False
|
48 |
+
)
|
49 |
+
|
50 |
+
# CLIP ViT Large
|
51 |
+
snapshot_download(
|
52 |
+
repo_id="openai/clip-vit-large-patch14",
|
53 |
+
local_dir="./clip-vit-large-patch14",
|
54 |
+
local_dir_use_symlinks=False
|
55 |
+
)
|
56 |
+
|
57 |
+
# DINO ViT-s16
|
58 |
+
snapshot_download(
|
59 |
+
repo_id="facebook/dino-vits16",
|
60 |
+
local_dir="./dino-vits16",
|
61 |
+
local_dir_use_symlinks=False
|
62 |
+
)
|
63 |
+
|
64 |
+
# mPLUG Visual Question Answering
|
65 |
+
snapshot_download(
|
66 |
+
repo_id="xingjianleng/mplug_visual-question-answering_coco_large_en",
|
67 |
+
local_dir="./mplug_visual-question-answering_coco_large_en",
|
68 |
+
local_dir_use_symlinks=False
|
69 |
+
)
|
70 |
+
|
71 |
+
# XVerse
|
72 |
+
snapshot_download(
|
73 |
+
repo_id="ByteDance/XVerse",
|
74 |
+
local_dir="./XVerse",
|
75 |
+
local_dir_use_symlinks=False
|
76 |
+
)
|
77 |
+
|
78 |
+
|
79 |
+
os.environ["FLORENCE2_MODEL_PATH"] = "./checkpoints/Florence-2-large"
|
80 |
+
os.environ["SAM2_MODEL_PATH"] = "./checkpoints/sam2.1_hiera_large.pt"
|
81 |
+
os.environ["FACE_ID_MODEL_PATH"] = "./checkpoints/model_ir_se50.pth"
|
82 |
+
os.environ["CLIP_MODEL_PATH"] = "./checkpoints/clip-vit-large-patch14"
|
83 |
+
os.environ["FLUX_MODEL_PATH"] = "./checkpoints/FLUX.1-dev"
|
84 |
+
os.environ["DPG_VQA_MODEL_PATH"] = "./checkpoints/mplug_visual-question-answering_coco_large_en"
|
85 |
+
os.environ["DINO_MODEL_PATH"] = "./checkpoints/dino-vits16"
|
86 |
|
87 |
dtype = torch.bfloat16
|
88 |
device = "cuda"
|