gengs commited on
Commit
bb04441
1 Parent(s): 9587d2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -1,34 +1,34 @@
1
- import gradio as gr
2
- from diffusers import StableDiffusion3Pipeline
3
- import torch
4
- import os
5
- from huggingface_hub import login
6
 
7
- # 通过环境变量获取 Token
8
- hf_token = os.getenv("HF_TOKEN")
9
 
10
- # 使用 Hugging Face Token 登录
11
- login(token=hf_token)
12
 
13
- pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large", torch_dtype=torch.bfloat16)
14
- pipe.load_lora_weights("prithivMLmods/SD3.5-Large-Photorealistic-LoRA", weight_name="Photorealistic-SD3.5-Large-LoRA.safetensors")
15
- pipe.fuse_lora(lora_scale=1.0)
16
 
17
- # 定义图像生成函数
18
- def generate_image(prompt):
19
- print(prompt)
20
- return pipe(prompt).images[0]
21
 
22
- # 创建 Gradio 界面
23
- iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
24
 
25
- # 启动界面
26
- iface.launch()
27
 
28
 
29
- # import gradio as gr
30
 
31
- # gr.load("models/prithivMLmods/SD3.5-Large-Photorealistic-LoRA").launch()
32
 
33
 
34
 
 
1
+ # import gradio as gr
2
+ # from diffusers import StableDiffusion3Pipeline
3
+ # import torch
4
+ # import os
5
+ # from huggingface_hub import login
6
 
7
+ # # 通过环境变量获取 Token
8
+ # hf_token = os.getenv("HF_TOKEN")
9
 
10
+ # # 使用 Hugging Face Token 登录
11
+ # login(token=hf_token)
12
 
13
+ # pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large", torch_dtype=torch.bfloat16)
14
+ # pipe.load_lora_weights("prithivMLmods/SD3.5-Large-Photorealistic-LoRA", weight_name="Photorealistic-SD3.5-Large-LoRA.safetensors")
15
+ # pipe.fuse_lora(lora_scale=1.0)
16
 
17
+ # # 定义图像生成函数
18
+ # def generate_image(prompt):
19
+ # print(prompt)
20
+ # return pipe(prompt).images[0]
21
 
22
+ # # 创建 Gradio 界面
23
+ # iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
24
 
25
+ # # 启动界面
26
+ # iface.launch()
27
 
28
 
29
+ import gradio as gr
30
 
31
+ gr.load("models/prithivMLmods/SD3.5-Large-Photorealistic-LoRA").launch()
32
 
33
 
34