Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,8 +50,8 @@ def generate(description, model_choice, guidance_scale, negative_prompt, style):
|
|
| 50 |
result = llm(instruction, max_length=128)[0]["generated_text"].strip()
|
| 51 |
prompt = result
|
| 52 |
# 根据模型选择生成图像
|
| 53 |
-
|
| 54 |
-
image =
|
| 55 |
prompt,
|
| 56 |
guidance_scale=guidance_scale,
|
| 57 |
negative_prompt=negative_prompt
|
|
@@ -82,7 +82,8 @@ with gr.Blocks(title="Prompt-to-Image Generator") as demo:
|
|
| 82 |
placeholder="排除内容(如:低分辨率、水印)"
|
| 83 |
)
|
| 84 |
use_voice = gr.Checkbox(label="启用语音输入(加分项)")
|
| 85 |
-
|
|
|
|
| 86 |
generate_btn = gr.Button("生成图像")
|
| 87 |
with gr.Column():
|
| 88 |
prompt_output = gr.Textbox(label="生成的提示词")
|
|
@@ -107,4 +108,3 @@ with gr.Blocks(title="Prompt-to-Image Generator") as demo:
|
|
| 107 |
# Step 4: 启动应用
|
| 108 |
if __name__ == "__main__":
|
| 109 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 110 |
-
|
|
|
|
| 50 |
result = llm(instruction, max_length=128)[0]["generated_text"].strip()
|
| 51 |
prompt = result
|
| 52 |
# 根据模型选择生成图像
|
| 53 |
+
pipeline_model = sd_xl if model_choice == "SDXL" else sd_v15
|
| 54 |
+
image = pipeline_model(
|
| 55 |
prompt,
|
| 56 |
guidance_scale=guidance_scale,
|
| 57 |
negative_prompt=negative_prompt
|
|
|
|
| 82 |
placeholder="排除内容(如:低分辨率、水印)"
|
| 83 |
)
|
| 84 |
use_voice = gr.Checkbox(label="启用语音输入(加分项)")
|
| 85 |
+
# 移除 'source' 参数以兼容 Gradio 版本
|
| 86 |
+
audio_input = gr.Audio(type="filepath", label="语音输入")
|
| 87 |
generate_btn = gr.Button("生成图像")
|
| 88 |
with gr.Column():
|
| 89 |
prompt_output = gr.Textbox(label="生成的提示词")
|
|
|
|
| 108 |
# Step 4: 启动应用
|
| 109 |
if __name__ == "__main__":
|
| 110 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|