Update app.py
Browse files
app.py
CHANGED
|
@@ -6,16 +6,22 @@ import os
|
|
| 6 |
import base64
|
| 7 |
from PIL import Image, PngImagePlugin
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
with gr.Blocks() as block:
|
| 10 |
with gr.Row():
|
| 11 |
txt_prompt = gr.Text(label="Prompt",value="1girl",lines=2)
|
| 12 |
with gr.Row():
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
with gr.Row():
|
| 15 |
image = gr.Image()
|
| 16 |
|
| 17 |
def generate(prompt):
|
| 18 |
-
url = os.environ['url']
|
| 19 |
payload = {
|
| 20 |
"seed": -1,
|
| 21 |
"sampler_name": "Euler",
|
|
@@ -43,5 +49,4 @@ with gr.Blocks() as block:
|
|
| 43 |
outputs=[image]
|
| 44 |
)
|
| 45 |
|
| 46 |
-
block.queue().launch()
|
| 47 |
-
|
|
|
|
| 6 |
import base64
|
| 7 |
from PIL import Image, PngImagePlugin
|
| 8 |
|
| 9 |
+
url = os.environ['url']
|
| 10 |
+
status_code = requests.get(url).status_code
|
| 11 |
+
|
| 12 |
+
|
| 13 |
with gr.Blocks() as block:
|
| 14 |
with gr.Row():
|
| 15 |
txt_prompt = gr.Text(label="Prompt",value="1girl",lines=2)
|
| 16 |
with gr.Row():
|
| 17 |
+
if status_code == requests.codes.ok:
|
| 18 |
+
btn_generate = gr.Button("Generate",variant="primary")
|
| 19 |
+
else:
|
| 20 |
+
btn_generate = gr.Button("Sorry, not working",variant="secondary")
|
| 21 |
with gr.Row():
|
| 22 |
image = gr.Image()
|
| 23 |
|
| 24 |
def generate(prompt):
|
|
|
|
| 25 |
payload = {
|
| 26 |
"seed": -1,
|
| 27 |
"sampler_name": "Euler",
|
|
|
|
| 49 |
outputs=[image]
|
| 50 |
)
|
| 51 |
|
| 52 |
+
block.queue().launch()
|
|
|