abmSS commited on
Commit
124310f
·
verified ·
1 Parent(s): cc1e960

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -14
app.py CHANGED
@@ -1,17 +1,12 @@
1
- import gradio as gr
 
2
 
3
- # Load the base model using the Hugging Face Inference API
4
- def model_interface():
5
- return gr.load("black-forest-labs/FLUX.1-dev", src="models")
6
 
7
- # Load the LoRA
8
- def lora_interface():
9
- return gr.load("models/enhanceaiteam/Flux-Uncensored-V2", lora=True)
10
 
11
- # Initialize the interfaces
12
- base_model = model_interface()
13
- lora_model = lora_interface()
14
-
15
- # Launch the interfaces
16
- base_model.launch()
17
- lora_model.launch()
 
1
+ from diffusers import AutoPipelineForText2Image
2
+ import torch
3
 
4
+ # Load the base model
5
+ pipeline = AutoPipelineForText2Image.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16).to('cuda')
 
6
 
7
+ # Load the uncensored LoRA weights
8
+ pipeline.load_lora_weights('enhanceaiteam/Flux-uncensored-v2', weight_name='lora.safetensors')
 
9
 
10
+ # Generate an image with an uncensored NSFW prompt
11
+ image = pipeline('a naked cute girl').images[0]
12
+ image.show()