Text-to-Image
English
Not-For-All-Audiences
seawolf2357 commited on
Commit
328160f
·
verified ·
1 Parent(s): 5123177

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +51 -0
README.md CHANGED
@@ -13,3 +13,54 @@ pipeline_tag: text-to-image
13
  #### Model Description
14
  This model is a playground that minimizes censorship restrictions, allowing exploration of the technical possibilities of AI-based image generation. Through various prompts, you can test censorship boundaries and verify the actual performance of image generation AI.
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  #### Model Description
14
  This model is a playground that minimizes censorship restrictions, allowing exploration of the technical possibilities of AI-based image generation. Through various prompts, you can test censorship boundaries and verify the actual performance of image generation AI.
15
 
16
+
17
+ ## Example code
18
+
19
+ ```python
20
+ import torch
21
+ from diffusers import AutoPipelineForText2Image
22
+
23
+ # PEFT 라이브러리 필요 (LoRA 로딩용)
24
+ from peft import PeftModel, PeftConfig
25
+
26
+ # 기기 설정
27
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
28
+
29
+ # 기본 모델 로드
30
+ print("기본 FLUX 모델 로드 중...")
31
+ pipe = AutoPipelineForText2Image.from_pretrained(
32
+ "black-forest-labs/FLUX.1-dev",
33
+ torch_dtype=torch.float16 # bfloat16 대신 float16 사용
34
+ )
35
+ pipe.to(device)
36
+
37
+ # Uncensored LoRA 로드
38
+ print("Uncensored LoRA 로드 중...")
39
+ pipe.load_lora_weights(
40
+ 'Heartsync/Flux-NSFW-uncensored',
41
+ weight_name='lora.safetensors',
42
+ adapter_name="uncensored"
43
+ )
44
+
45
+ # 이미지 생성
46
+ prompt = "A woman in a sheer white dress standing on a beach at sunset, backlit so her silhouette is visible through the thin fabric, shot with Canon EOS R5, 85mm f/1.2 lens, golden hour natural lighting, professional composition, hyperrealistic detail, masterpiece quality, 8K resolution."
47
+ negative_prompt = "text, watermark, signature, cartoon, anime, illustration, painting, drawing, low quality, blurry"
48
+
49
+ # 시드 설정
50
+ seed = 42
51
+ generator = torch.Generator(device=device).manual_seed(seed)
52
+
53
+ # 이미지 생성
54
+ image = pipe(
55
+ prompt=prompt,
56
+ negative_prompt=negative_prompt,
57
+ guidance_scale=7.0,
58
+ num_inference_steps=28,
59
+ width=1024,
60
+ height=1024,
61
+ generator=generator,
62
+ ).images[0]
63
+
64
+ # 이미지 저장
65
+ image.save("generated_image.png")
66
+ ```