File size: 1,623 Bytes
412c060
dfd9f8c
412c060
4329e76
412c060
4329e76
4ba6411
4329e76
 
 
 
 
4ba6411
 
4329e76
 
 
 
 
 
 
4ba6411
 
 
 
4329e76
 
 
 
412c060
4329e76
 
4ba6411
4329e76
dfd9f8c
4ba6411
4329e76
 
4ba6411
dfd9f8c
412c060
dfd9f8c
4329e76
4ba6411
4329e76
412c060
4ba6411
4329e76
412c060
4ba6411
4329e76
412c060
dfd9f8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
import time

MODEL_ID = "1c1/Visionpy"

pipe = StableDiffusionPipeline.from_pretrained(
    MODEL_ID,
    torch_dtype=torch.float16
).to("cuda")
pipe.enable_xformers_memory_efficient_attention()  # VRAM ve hız optimizasyonu

def generate(prompt, mode, res):
    start_time = time.time()
    
    # Hız modu için inference adımları
    steps = 20  # Hızlı üretim
    guidance = 7.5
    
    # Çözünürlük
    if res == "512p":
        w, h = 512, 512
    elif res == "1024p":
        w, h = 1024, 1024
    else:
        w, h = 512, 512  # 4K/8K hızlı üretimde varsayılan olarak 512
    
    image = pipe(prompt, height=h, width=w, num_inference_steps=steps, guidance_scale=guidance).images[0]

    elapsed = time.time() - start_time
    return image, f"{elapsed:.2f} saniyede üretildi!"

with gr.Blocks(theme="soft", title="Hh — VisionPy Ultra HD 11s Mode") as demo:
    gr.Markdown(
        """
        # 🌟 Hh — VisionPy Ultra HD
        **Anime / Realistic modları, Light Theme, 11 saniyede hızlı üretim!**
        """
    )

    with gr.Row():
        prompt = gr.Textbox(label="Prompt", placeholder="ör: fantastik şehir, ultra yüksek çözünürlük")
        mode = gr.Dropdown(["Realistic", "Anime"], label="Mod")
        res = gr.Dropdown(["512p", "1024p"], label="Çözünürlük (Hızlı Mod)")

    out = gr.Image(label="Sonuç")
    time_label = gr.Label(label="Üretim Süresi")

    btn = gr.Button("ÜRET")
    btn.click(generate, inputs=[prompt, mode, res], outputs=[out, time_label])

demo.launch()