Binancenode commited on
Commit
b6ac975
·
verified ·
1 Parent(s): dc6cc3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -28
app.py CHANGED
@@ -1,31 +1,12 @@
1
- import torch
2
- from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
3
- import gradio as gr
4
-
5
- # Basismodell laden
6
- base_model = "runwayml/stable-diffusion-v1-5"
7
- pipe = StableDiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.float16).to("cuda")
8
-
9
- # Optional: NSFW-Filter deaktivieren
10
- pipe.safety_checker = lambda images, **kwargs: (images, False)
11
-
12
- # LoRA laden (Beispiel: LoRA-Dateien lokal gespeichert)
13
- pipe.load_lora_weights("path/to/lora_weights")
14
 
15
- # LoRA aktivieren (nur nötig bei manchen Implementierungen)
16
- pipe.fuse_lora()
17
-
18
- def generate(prompt):
19
- image = pipe(prompt).images[0]
20
- return image
21
-
22
- with gr.Blocks() as demo:
23
- with gr.Row():
24
- gr.Markdown("## NSFW Uncensored + LoRA Stable Diffusion")
25
- prompt = gr.Textbox(label="Prompt", placeholder="Eingabe z.B. 'a nude portrait in oil painting style'")
26
- output = gr.Image()
27
- btn = gr.Button("Generate")
28
-
29
- btn.click(fn=generate, inputs=prompt, outputs=output)
30
 
 
 
 
 
 
 
 
 
31
  demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
+ with gr.Blocks(fill_height=True) as demo:
5
+ with gr.Sidebar():
6
+ gr.Markdown("# Inference Provider")
7
+ gr.Markdown("This Space showcases the black-forest-labs/FLUX.1-dev model, served by the hf-inference API. Sign in with your Hugging Face account to use this API.")
8
+ share=True
9
+ button = gr.LoginButton("Sign in")
10
+ gr.load("models/black-forest-labs/FLUX.1-dev", accept_token=button, provider="hf-inference")
11
+
12
  demo.launch()