Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,26 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
gr.load("models/prithivMLmods/SD3.5-Large-Photorealistic-LoRA").launch()
|
4 |
|
5 |
# import gradio as gr
|
6 |
# import torch
|
|
|
1 |
import gradio as gr
|
2 |
+
from diffusers import StableDiffusion3Pipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
# 加载模型
|
6 |
+
pipe = StableDiffusion3Pipeline.from_pretrained("models/prithivMLmods/SD3.5-Large-Photorealistic-LoRA", torch_dtype=torch.float16)
|
7 |
+
|
8 |
+
# 定义图像生成函数
|
9 |
+
def generate_image(prompt):
|
10 |
+
return pipe(prompt).images[0]
|
11 |
+
|
12 |
+
# 创建 Gradio 界面
|
13 |
+
iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
|
14 |
+
|
15 |
+
# 启动界面
|
16 |
+
iface.launch()
|
17 |
+
|
18 |
+
|
19 |
+
# import gradio as gr
|
20 |
+
|
21 |
+
# gr.load("models/prithivMLmods/SD3.5-Large-Photorealistic-LoRA").launch()
|
22 |
+
|
23 |
|
|
|
24 |
|
25 |
# import gradio as gr
|
26 |
# import torch
|