File size: 1,717 Bytes
e425bfb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch

MODEL_ID = "1c1/Hh"  # Space’e yüklediğin modelin ID’si veya SD1.5 base

# Pipeline yükleme
pipe = StableDiffusionPipeline.from_pretrained(
    MODEL_ID,
    torch_dtype=torch.float16,
).to("cuda")

# Sohbet geçmişi
history = []

def chat_and_generate(message, mode, size, turbo):
    global history
    # Bot cevabı
    reply = f"Tamam! '{message}' için görsel üretebilirim."
    history.append(("Kullanıcı: " + message, "Bot: " + reply))
    
    # Görsel üretim
    w, h = map(int, size.split("x"))
    steps = 16 if turbo else 30

    prompt = message
    if mode == "Anime":
        prompt += ", anime style, sharp lines, vibrant colors"
    else:
        prompt += ", ultra realistic, 8k, detailed textures"

    image = pipe(prompt, num_inference_steps=steps, width=w, height=h).images[0]
    return history, image

# Arayüz
sizes = ["512x512", "768x768", "1024x1024", "1536x1536", "4096x4096", "7680x4320"]

with gr.Blocks(title="ZImageAI – VisionPy") as demo:
    gr.Markdown("<h1 style='text-align:center'>🚀 ZImageAI – VisionPy Ultra HD</h1>")
    
    with gr.Row():
        msg = gr.Textbox(label="Mesaj / Prompt", placeholder="örn: bir dağ manzarası, güneşli hava")
        mode = gr.Radio(["Anime", "Gerçekçi"], value="Gerçekçi", label="Mod")
        size = gr.Dropdown(sizes, value="1024x1024", label="Görsel Boyutu")
        turbo = gr.Checkbox(label="⚡ 11s Turbo Mod", value=False)

    chatbox = gr.Chatbot(label="Sohbet / Görsel")
    btn = gr.Button("Gönder ve Üret")

    btn.click(chat_and_generate, inputs=[msg, mode, size, turbo], outputs=[chatbox, chatbox])

demo.launch()