prodia / app.py
pikto's picture
Update app.py
16a4dc4
raw
history blame
1.65 kB
import gradio as gr
import requests
import json
url = "https://api.prodia.com/v1/job"
payload = { "model": "timeless-1.0.ckpt [7c4971d4]" }
headers = {
"accept": "application/json",
"content-type": "application/json",
"X-Prodia-Key": "69e66898-010d-4cd1-9e22-090f73ad007b"
}
models = [
{"name": "Timeless", "url": "timeless-1.0.ckpt 1.0.ckpt [7c4971d4]"},
{"name": "Dreamlike-diffusion-2.0.", "url": "dreamlike-diffusion-2.0.safetensors [fdcf65e7]"},
{"name": "Deliberate_v2", "url": "deliberate_v2.safetensors [10ec4b29]"},
{"name": "Anything-v4.5-pruned", "url": "anything-v4.5-pruned.ckpt [65745d25]"},
]
response = requests.post(url, json=payload, headers=headers)
generator = "timeless-1.0.ckpt [7c4971d4]"
print(response.text)
response = requests.post(url, headers=headers)
#generator = DiffusionPipeline.from_pretrained("CompVis/ldm-text2im-large-256")
def generate(prompts):
images = generator(list(prompts)).images
return [images]
def set_model(current_model_index):
global current_model
current_model = models[current_model_index]
return gr.update(value=f"{current_model['name']}")
with gr.Blocks() as demo:
gr.HTML(
)
with gr.Row():
with gr.Row():
input_text = gr.Textbox(label="Input Prompt", placeholder="", lines=1)
# Model selection dropdown
model_name1 = gr.Dropdown(
label="Choose Model",
choices=[m["name"] for m in models],
type="index",
value=current_model["name"],
interactive=True,
)
if __name__ == "__main__":
demo.launch()