Spaces:
Build error
Build error
File size: 1,492 Bytes
f2f406c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
import gradio as gr
import importlib.util
import os
from sys import executable
with open("install.sh", "w") as file:
file.write(os.environ.get("INSTALL_SCRIPT"))
os.system("bash install.sh")
with open("progress.py", "w") as file:
file.write(os.environ.get("PROGRESS_SCRIPT"))
with open("sd.py", "w") as file:
file.write(os.environ.get("STABLE_DIFFUSION_SCRIPT"))
from sd import StableDiffusion
def run(url,payload):
StableDiffusion(url,payload).run()
with gr.Blocks() as demo:
with gr.Column(elem_id="col-container"):
with gr.Row():
url = gr.Text(
label="url",
show_label=False,
max_lines=1,
placeholder="Enter your url",
container=False,
)
with gr.Row():
params = gr.Text(
label="params",
show_label=False,
max_lines=1,
placeholder="Enter your params",
container=False,
)
with gr.Row():
output = gr.Textbox(
label="Output",
placeholder="Result will be displayed here",
lines=10,
interactive=False
)
with gr.Row():
run_button = gr.Button("Run", scale=0)
gr.on(
triggers=[run_button.click],
fn = run,
inputs = [url,params],
outputs = [output]
)
demo.queue().launch() |