Spaces:
Runtime error
Runtime error
Update app.py
Browse files80 unmodified lines8182838485868788899091929394959697989910010118 unmodified lines12012112212312412563 unmodified lines18919019119219319427 unmodified lines222223224225226227228229230102 unmodified lines33333433533633733880 unmodified linesprint("prompt: \n", prompt_trans)return prompt_trans# 定义一个函数来处理图片尺寸的选择def set_size(option):if option == "横版":width, height = 1024, 736elif option == "竖版":width, height = 736, 1024elif option == "方形":width, height = 736, 736else:width, height = 736, 1024 # 可以定义一个默认值return width, height@spaces.GPUdef generate(prompt: str,negative_prompt: str = "",prompt_2: str = "",negative_prompt_2: str = "",18 unmodified linesif not use_negative_prompt_2:negative_prompt_2 = None # type: ignore# process_text("里面做一个测试")# print("prompt是:", prompt)# print("negative_prompt是:", negative_prompt)63 unmodified linesrun_button = gr.Button("生成", scale=0)result = gr.Image(label="生成结果", show_label=False)with gr.Accordion("高级选项", open=False):with gr.Row():27 unmodified linesvalue=0,)randomize_seed = gr.Checkbox(label="随机种子数", value=True)# 使用 Radio 组件替代两个 Slider 组件size_option = gr.Radio(choices=["横版", "竖版", "方形"], label="选择尺寸", value="竖版")# with gr.Row():# width = gr.Slider(102 unmodified linesfn=generate,inputs=[prompt,negative_prompt,prompt_2,negative_prompt_2,80 unmodified lines8182838485868788899018 unmodified lines10911011111211311411511611711811912012112212312463 unmodified lines18818919019119219319419527 unmodified lines223224225226227228102 unmodified lines33133233333433533633780 unmodified linesprint("prompt: \n", prompt_trans)return prompt_trans@spaces.GPUdef generate(prompt: str,size_option: str = "竖版",negative_prompt: str = "",prompt_2: str = "",negative_prompt_2: str = "",18 unmodified linesif not use_negative_prompt_2:negative_prompt_2 = None # type: ignoreif size_option == "横版":width, height = 1024, 736elif size_option == "竖版":width, height = 736, 1024elif size_option == "方形":width, height = 736, 736else:width, height = 736, 1024 # 可以定义一个默认值# process_text("里面做一个测试")# print("prompt是:", prompt)# print("negative_prompt是:", negative_prompt)63 unmodified linesrun_button = gr.Button("生成", scale=0)result = gr.Image(label="生成结果", show_label=False)# 使用 Radio 组件替代两个 Slider 组件size_option = gr.Radio(choices=["横版", "竖版", "方形"], label="选择尺寸", value="竖版")with gr.Accordion("高级选项", open=False):with gr.Row():27 unmodified linesvalue=0,)randomize_seed = gr.Checkbox(label="随机种子数", value=True)# with gr.Row():# width = gr.Slider(102 unmodified linesfn=generate,inputs=[prompt,size_option,negative_prompt,prompt_2,negative_prompt_2,
app.py+14-15