En3rGy commited on
Commit
2657e2e
·
verified ·
1 Parent(s): bdfaf53

upload app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from diffusers import StableDiffusionXLPipeline
3
+ import gradio as gr
4
+
5
+ # Modell-ID
6
+ MODEL_ID = "En3rGy/getphatFLUXReality_v5Hardcore"
7
+
8
+ # Modell laden
9
+ print("Lade Modell...")
10
+ pipe = StableDiffressionXLPipeline.from_pretrained(
11
+ MODEL_ID,
12
+ torch_dtype=torch.float16,
13
+ variant="fp16"
14
+ )
15
+ pipe.to("cuda")
16
+ print("Modell erfolgreich geladen.")
17
+
18
+ # Generierungsfunktion
19
+ def generate(prompt):
20
+ with torch.autocast("cuda"):
21
+ image = pipe(prompt, num_inference_steps=30, guidance_scale=7.5).images[0]
22
+ return image
23
+
24
+ # UI bauen
25
+ with gr.Blocks() as demo:
26
+ gr.Markdown("# getphatFLUXReality Generator")
27
+ prompt = gr.Textbox(label="Prompt", placeholder="Enter your masterpiece...")
28
+ output = gr.Image(label="Generated Image")
29
+ run_button = gr.Button("Generate")
30
+ run_button.click(fn=generate, inputs=prompt, outputs=output)
31
+
32
+ demo.launch()