Teotonix commited on
Commit
e2a5470
·
verified ·
1 Parent(s): 2b5e5aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -18
app.py CHANGED
@@ -39,33 +39,63 @@ img_pipe = img_pipe.to("cpu")
39
 
40
  def generate_image(prompt):
41
  if not prompt.strip():
42
- raise gr.Error("Prompt boş olamaz")
43
 
44
  image = img_pipe(
45
  prompt,
46
- num_inference_steps=20
 
 
47
  ).images[0]
48
 
49
  return image
50
 
 
51
  # ---------------- UI ----------------
52
- with gr.Blocks(title="MaindAI") as app:
53
- gr.Markdown(
54
- """
55
- <div style="text-align:center">
56
- <img src="file=Maindai.png" width="140"><br>
57
- <h1 style="color:#00bfff;">MaindAI</h1>
58
- </div>
59
- """
60
- )
61
 
62
- with gr.Row():
63
- with gr.Column():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  gr.ChatInterface(chat_fn)
65
- with gr.Column():
66
- prompt = gr.Textbox(label="🎨 Görsel Prompt")
67
- btn = gr.Button("Oluştur")
68
- output = gr.Image()
69
- btn.click(generate_image, prompt, output)
 
 
 
 
 
 
 
 
 
70
 
71
  app.launch()
 
39
 
40
  def generate_image(prompt):
41
  if not prompt.strip():
42
+ raise gr.Error("Prompt boş")
43
 
44
  image = img_pipe(
45
  prompt,
46
+ height=512,
47
+ width=512,
48
+ num_inference_steps=12
49
  ).images[0]
50
 
51
  return image
52
 
53
+
54
  # ---------------- UI ----------------
55
+ import gradio as gr
56
+
57
+ theme = gr.themes.Soft(
58
+ primary_hue="blue",
59
+ secondary_hue="cyan",
60
+ neutral_hue="slate",
61
+ font=[gr.themes.GoogleFont("Inter")]
62
+ )
 
63
 
64
+ with gr.Blocks(
65
+ title="MaindAI",
66
+ theme=theme,
67
+ css="""
68
+ body { background: #0b1220; }
69
+ .gradio-container { max-width: 900px !important; }
70
+ footer { display: none !important; }
71
+ """
72
+ ) as app:
73
+
74
+ gr.Markdown("""
75
+ <div style="display:flex;align-items:center;gap:12px;">
76
+ <img src="file=Maindai.png" width="48">
77
+ <h1 style="color:#3b82f6;margin:0;">MaindAI</h1>
78
+ </div>
79
+ <p style="color:#94a3b8;">Chat & Görsel Üretim</p>
80
+ """)
81
+
82
+ with gr.Tabs():
83
+
84
+ with gr.Tab("💬 Chat"):
85
  gr.ChatInterface(chat_fn)
86
+
87
+ with gr.Tab("🎨 Görsel"):
88
+ prompt = gr.Textbox(
89
+ label="Görsel açıklaması",
90
+ placeholder="örnek: cyberpunk mavi tonlarda bir şehir"
91
+ )
92
+ btn = gr.Button("Oluştur", variant="primary")
93
+ img = gr.Image(height=512)
94
+
95
+ btn.click(
96
+ generate_image,
97
+ inputs=prompt,
98
+ outputs=img
99
+ )
100
 
101
  app.launch()