Merge pull request #61 from AbdullahAlfaraj/main

[API]: Retrieve the subjects, artists, image types lists through the API
This commit is contained in:
AIrjen
2023-06-30 08:09:25 +02:00
committed by GitHub
+12
View File
@@ -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"),