Spaces:
Sleeping
Sleeping
Update main.py
Browse files172 unmodified lines17317417517617617717817912 unmodified lines192193194195196197198199200201202195196197198199200201202203204205206207208209210211212213172 unmodified lines
@app.post("/Immagine")def generate_image(request: Request, input_data: InputImage): client = Client("https://openskyml-fast-sdxl-stable-diffusion-xl.hf.space/--replicas/545b5tw7n/") client = Client("https://hysts-sd-xl.hf.space/--replicas/cplz0/") if input_data.style: print(input_data.style)12 unmodified lines while attempt < max_attempts: try: result = client.predict( input_data.input, input_data.negativePrompt, input_data.steps, input_data.cfg, 1024, 1024, input_data.seed, fn_index=0 input_data.input, # str in 'Prompt' Textbox component input_data.negativePrompt, # str in 'Negative prompt' Textbox component input_data.input, # str in 'Prompt 2' Textbox component input_data.negativePrompt, # str in 'Negative prompt 2' Textbox component True, # bool in 'Use negative prompt' Checkbox component True, # bool in 'Use prompt 2' Checkbox component True, # bool in 'Use negative prompt 2' Checkbox component input_data.seed, # float (numeric value between 0 and 2147483647) in 'Seed' Slider component 1024, # float (numeric value between 256 and 1024) in 'Width' Slider component 1024, # float (numeric value between 256 and 1024) in 'Height' Slider component input_data.cfg, # float (numeric value between 1 and 20) in 'Guidance scale for base' Slider component input_data.cfg, # float (numeric value between 1 and 20) in 'Guidance scale for refiner' Slider component input_data.steps, # float (numeric value between 10 and 100) in 'Number of inference steps for base' Slider component input_data.steps, # float (numeric value between 10 and 100) in 'Number of inference steps for refiner' Slider component True, # bool in 'Apply refiner' Checkbox component api_name="/run" ) image_url = result with open(image_url, 'rb') as img_file:main.py+17-9