Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,9 +25,20 @@ models = [
|
|
| 25 |
Model("SD21","models/stabilityai/stable-diffusion-2-1", "")
|
| 26 |
]
|
| 27 |
|
| 28 |
-
custom_model = models[3].path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
sandbox = gr.Interface.load(
|
|
|
|
| 31 |
name= custom_model,
|
| 32 |
title="""AlStable sandbox""",
|
| 33 |
prompt = gr.Textbox(label="Prompt", show_label=False, max_lines=2, placeholder="Enter your prompt~", elem_id="input-prompt"),
|
|
@@ -35,4 +46,7 @@ sandbox = gr.Interface.load(
|
|
| 35 |
article=article,
|
| 36 |
api_key=API_KEY
|
| 37 |
)
|
|
|
|
|
|
|
|
|
|
| 38 |
sandbox.queue(concurrency_count=20).launch()
|
|
|
|
| 25 |
Model("SD21","models/stabilityai/stable-diffusion-2-1", "")
|
| 26 |
]
|
| 27 |
|
| 28 |
+
"""custom_model = models[3].path"""
|
| 29 |
+
|
| 30 |
+
def selectModel(message):
|
| 31 |
+
message = message.lower()
|
| 32 |
+
for i in range(len(models)):
|
| 33 |
+
if message.find(models[i].prefix)!=-1:
|
| 34 |
+
c_model=models[i].path
|
| 35 |
+
return custom_model
|
| 36 |
+
else:
|
| 37 |
+
c_model=models[i].path
|
| 38 |
+
return c_model
|
| 39 |
|
| 40 |
sandbox = gr.Interface.load(
|
| 41 |
+
selectModel,
|
| 42 |
name= custom_model,
|
| 43 |
title="""AlStable sandbox""",
|
| 44 |
prompt = gr.Textbox(label="Prompt", show_label=False, max_lines=2, placeholder="Enter your prompt~", elem_id="input-prompt"),
|
|
|
|
| 46 |
article=article,
|
| 47 |
api_key=API_KEY
|
| 48 |
)
|
| 49 |
+
|
| 50 |
+
custom_model=sandbox.selectModel(prompt)
|
| 51 |
+
|
| 52 |
sandbox.queue(concurrency_count=20).launch()
|