请基于以下的api构建一个api后端和对应的前端页面:
from gradio_client import Client
client = Client("https://hysts-sd-xl.hf.space/")
result = client.predict(
"Howdy!", # str in 'Prompt' Textbox component
"Howdy!", # str in 'Negative prompt' Textbox component
"Howdy!", # str in 'Prompt 2' Textbox component
"Howdy!", # 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
0, # int | float (numeric value between 0 and 2147483647) in 'Seed' Slider component
256, # int | float (numeric value between 256 and 1024) in 'Width' Slider component
256, # int | float (numeric value between 256 and 1024) in 'Height' Slider component
1, # int | float (numeric value between 1 and 20) in 'Guidance scale for base' Slider component
1, # int | float (numeric value between 1 and 20) in 'Guidance scale for refiner' Slider component
10, # int | float (numeric value between 10 and 100) in 'Number of inference steps for base' Slider component
10, # int | 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"
)
print(result)
Assistant
要基于这个 API 构建一个后端和前端,我们需要给用户提供一个界面来输入这些参数并发送请求到后端。后端将负责调用 API 并将结果返回给前端显示。