From 6874d22e05287e3563c5a8383a538490c2491f19 Mon Sep 17 00:00:00 2001 From: Abdullah Alfaraj Date: Thu, 29 Jun 2023 21:45:18 +0300 Subject: [PATCH] retrieve the subjects, artists, image types lists through the api --- scripts/api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/api.py b/scripts/api.py index f438c99..77c5bc6 100644 --- a/scripts/api.py +++ b/scripts/api.py @@ -1,12 +1,24 @@ from fastapi import FastAPI, Body import gradio as gr from build_dynamic_prompt import * +from scripts.onebuttonprompt import subjects, artists, imagetypes def one_button_prompt_api(_: gr.Blocks, app: FastAPI): @app.get("/one_button_prompt/version") async def version(): return {"version": 1.0} + @app.get("/one_button_prompt/config") + async def get_config(): + + config ={ + "subjects": subjects, + "artists": artists, + "imagetypes": imagetypes, + + } + return config + @app.post("/one_button_prompt/prompt/random") async def random_prompts(numberofprompts:int = Body(1,title="number of prompts"), insanitylevel: int= Body(5,title="insanity level"),