File size: 928 Bytes
2b755c2
 
 
 
 
 
 
8f873ac
 
310b4d5
2b755c2
 
 
 
 
 
 
310b4d5
2b755c2
 
c453122
2b755c2
 
 
 
 
 
 
8f873ac
 
 
 
 
2b755c2
 
 
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
31
32
33
34
35
36
37
#!/usr/bin/env python

import os

import gradio as gr
import torch

from app_base import create_demo as create_demo_base
from app_sketch import create_demo as create_demo_sketch
from model import ADAPTER_NAMES, Model, download_all_adapters

DESCRIPTION = "# T2I-Adapter-SDXL"

if not torch.cuda.is_available():
    DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"


download_all_adapters()
model = Model(ADAPTER_NAMES[0])


with gr.Blocks(css="style.css") as demo:
    gr.Markdown(DESCRIPTION)
    gr.DuplicateButton(
        value="Duplicate Space for private use",
        elem_id="duplicate-button",
        visible=os.getenv("SHOW_DUPLICATE_BUTTON") == "1",
    )
    with gr.Tabs():
        with gr.Tab(label="Base"):
            create_demo_base(model)
        with gr.Tab(label="Sketch"):
            create_demo_sketch(model)

if __name__ == "__main__":
    demo.queue(max_size=20).launch()