|
|
|
|
|
|
|
|
|
import gradio as gr |
|
import random |
|
|
|
|
|
model = gr.load("models/prithivMLmods/SD3.5-Large-Photorealistic-LoRA") |
|
|
|
|
|
def generate_image(prompt, seed=None): |
|
if seed is None: |
|
seed = random.randint(0, 1e6) |
|
|
|
result = model(prompt=prompt, seed=seed) |
|
return result |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("## 输入描述和种子以生成图像") |
|
prompt = gr.Textbox(label="描述") |
|
seed = gr.Number(label="种子 (可选)", value=None) |
|
output_image = gr.Image() |
|
|
|
generate_button = gr.Button("生成图像") |
|
generate_button.click(generate_image, inputs=[prompt, seed], outputs=output_image) |
|
|
|
|
|
demo.launch() |