Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
import torch
|
5 |
+
|
6 |
+
from app_base import create_demo as create_demo_base
|
7 |
+
from app_sketch import create_demo as create_demo_sketch
|
8 |
+
from model import ADAPTER_NAMES, Model, download_all_adapters
|
9 |
+
|
10 |
+
DESCRIPTION = "@ stabble_diffusion_sketech"
|
11 |
+
|
12 |
+
if not torch.cuda.is_available():
|
13 |
+
DESCRIPTION += "\n<p>Running on CPU π₯Ά This demo does not work on CPU.</p>"
|
14 |
+
|
15 |
+
|
16 |
+
download_all_adapters()
|
17 |
+
model = Model(ADAPTER_NAMES[0])
|
18 |
+
|
19 |
+
|
20 |
+
with gr.Blocks(css="style.css") as demo:
|
21 |
+
gr.Markdown(DESCRIPTION)
|
22 |
+
gr.DuplicateButton(
|
23 |
+
value="Duplicate Space for private use",
|
24 |
+
elem_id="duplicate-button",
|
25 |
+
visible=os.getenv("SHOW_DUPLICATE_BUTTON") == "1",
|
26 |
+
)
|
27 |
+
with gr.Tabs():
|
28 |
+
with gr.Tab(label="Base"):
|
29 |
+
create_demo_base(model)
|
30 |
+
with gr.Tab(label="Sketch"):
|
31 |
+
create_demo_sketch(model)
|
32 |
+
|
33 |
+
if __name__ == "__main__":
|
34 |
+
demo.queue(max_size=20).launch()
|