Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,57 +1,42 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
-
import logging
|
4 |
-
|
5 |
-
LOG_FORMAT = '%(asctime)s - %(levelname)s [%(name)s] %(funcName)s -> %(message)s'
|
6 |
-
logging.basicConfig(level = logging.DEBUG, format = LOG_FORMAT)
|
7 |
-
logger = logging.getLogger(__name__)
|
8 |
-
logger.debug('Logging started')
|
9 |
|
10 |
API_KEY=os.environ.get('HUGGING_FACE_HUB_TOKEN', None)
|
11 |
article = """---
|
12 |
This space was created using [SD Space Creator](https://huggingface.co/spaces/anzorq/sd-space-creator)."""
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
models
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
Model("Portrait plus", "models/wavymulder/portraitplus", "portrait+ style"),
|
26 |
-
Model("classic Disney", "models/nitrosocke/classic-anim-diffusion", "classic disney style"),
|
27 |
-
Model("vintedois", "models/22h/vintedois-diffusion-v0-1", "vintedois style"),
|
28 |
-
Model("dreamlike", "models/dreamlike-art/dreamlike-diffusion-1.0","dreamlike style"),
|
29 |
-
Model("SD21","models/stabilityai/stable-diffusion-2-1", "sd21 default style")
|
30 |
]
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
def
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
name= custom_model,
|
48 |
-
title="""AlStable sandbox""",
|
49 |
-
inputs = gr.Textbox(label="Prompt", show_label=False, max_lines=2, placeholder="Enter your prompt", elem_id="input-prompt"),
|
50 |
-
description="""Demo for <a href="https://huggingface.co/stabilityai/stable-diffusion-2-1">AlStable</a> Stable Diffusion model.""",
|
51 |
article=article,
|
52 |
-
api_key=API_KEY
|
53 |
)
|
54 |
|
55 |
-
logging.warning('model chosen = '+custom_model)
|
56 |
-
|
57 |
sandbox.queue(concurrency_count=20).launch()
|
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
API_KEY=os.environ.get('HUGGING_FACE_HUB_TOKEN', None)
|
5 |
article = """---
|
6 |
This space was created using [SD Space Creator](https://huggingface.co/spaces/anzorq/sd-space-creator)."""
|
7 |
+
import gradio as gr
|
8 |
|
9 |
+
article = """---This space was created using [SD Space Creator](https://huggingface.co/spaces/anzorq/sd-space-creator)."""
|
10 |
+
|
11 |
+
MODLS=[
|
12 |
+
"models/ItsJayQz/Marvel_WhatIf_Diffusion",
|
13 |
+
"models/DGSpitzer/Cyberpunk-Anime-Diffusion",
|
14 |
+
"models/DGSpitzer/Guan-Yu-Diffusion",
|
15 |
+
"models/wavymulder/portraitplus",
|
16 |
+
"models/nitrosocke/classic-anim-diffusion",
|
17 |
+
"models/22h/vintedois-diffusion-v0-1",
|
18 |
+
"models/dreamlike-art/dreamlike-diffusion-1.0",
|
19 |
+
"models/stabilityai/stable-diffusion-2-1"
|
|
|
|
|
|
|
|
|
|
|
20 |
]
|
21 |
|
22 |
+
TXT="AlStable Demo"
|
23 |
+
|
24 |
+
def prediction(input_choice):
|
25 |
+
return gr.Image(input_choice)
|
26 |
+
|
27 |
+
def prediction(model_choice, input):
|
28 |
+
modl = MODLS[model_choice]
|
29 |
+
return modl
|
30 |
+
|
31 |
+
sandbox = gr.Interface(
|
32 |
+
fn=prediction,
|
33 |
+
inputs=gr.inputs.Dropdown(MODLS),
|
34 |
+
outputs=gr.Image(),
|
35 |
+
title=TXT,
|
36 |
+
description=TXT,
|
|
|
|
|
|
|
|
|
37 |
article=article,
|
38 |
+
api_key=API_KEY
|
39 |
)
|
40 |
|
|
|
|
|
41 |
sandbox.queue(concurrency_count=20).launch()
|
42 |
+
|