Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,17 @@
|
|
| 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 |
-
|
| 12 |
"models/ItsJayQz/Marvel_WhatIf_Diffusion",
|
| 13 |
"models/DGSpitzer/Cyberpunk-Anime-Diffusion",
|
| 14 |
"models/DGSpitzer/Guan-Yu-Diffusion",
|
|
@@ -19,24 +22,29 @@ MODLS=[
|
|
| 19 |
"models/stabilityai/stable-diffusion-2-1"
|
| 20 |
]
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
def
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
article=article,
|
| 38 |
-
api_key=API_KEY
|
| 39 |
)
|
| 40 |
|
| 41 |
-
|
| 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 |
+
models = [
|
| 15 |
"models/ItsJayQz/Marvel_WhatIf_Diffusion",
|
| 16 |
"models/DGSpitzer/Cyberpunk-Anime-Diffusion",
|
| 17 |
"models/DGSpitzer/Guan-Yu-Diffusion",
|
|
|
|
| 22 |
"models/stabilityai/stable-diffusion-2-1"
|
| 23 |
]
|
| 24 |
|
| 25 |
+
custom_model = "models/dreamlike-art/dreamlike-diffusion-1.0"
|
| 26 |
+
|
| 27 |
+
def selectModel(message):
|
| 28 |
+
message = message.lower()
|
| 29 |
+
for i in range(len(models)):
|
| 30 |
+
if message.find(models[i].prefix)!=-1:
|
| 31 |
+
c_model=models[i].path
|
| 32 |
+
logging.warning('model selected = '+c_model)
|
| 33 |
+
return c_model
|
| 34 |
+
c_model=models[i].path
|
| 35 |
+
logging.warning('model selected = '+c_model)
|
| 36 |
+
return c_model
|
| 37 |
+
|
| 38 |
+
sandbox = gr.Interface.load(
|
| 39 |
+
fn= selectModel,
|
| 40 |
+
name= custom_model,
|
| 41 |
+
title="""AlStable sandbox""",
|
| 42 |
+
inputs = gr.Textbox(label="Prompt", show_label=False, max_lines=2, placeholder="Enter your prompt", elem_id="input-prompt"),
|
| 43 |
+
description="""Demo for <a href="https://huggingface.co/stabilityai/stable-diffusion-2-1">AlStable</a> Stable Diffusion model.""",
|
| 44 |
article=article,
|
| 45 |
+
api_key=API_KEY
|
| 46 |
)
|
| 47 |
|
| 48 |
+
logging.warning('model chosen = '+custom_model)
|
| 49 |
|
| 50 |
+
sandbox.queue(concurrency_count=20).launch()
|