Update app.py
Browse files
app.py
CHANGED
|
@@ -26,24 +26,21 @@ def chat_fn(message, history):
|
|
| 26 |
def image_fn(prompt):
|
| 27 |
if not prompt: return None
|
| 28 |
try:
|
| 29 |
-
|
| 30 |
-
# Bu metod 'text_to_image'den daha yüksek önceliğe sahiptir
|
| 31 |
-
image = client.text_to_image(
|
| 32 |
-
prompt,
|
| 33 |
-
model="stabilityai/stable-diffusion-xl-base-1.0", # Çok kararlı bir model
|
| 34 |
-
)
|
| 35 |
-
return image
|
| 36 |
except Exception as e:
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
# Arayüz (Modern Dark Tema)
|
| 45 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", neutral_hue="slate")) as demo:
|
| 46 |
-
|
|
|
|
| 47 |
|
| 48 |
with gr.Tabs():
|
| 49 |
with gr.TabItem("💬 Akıllı Sohbet"):
|
|
@@ -52,10 +49,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", neutral_hue="slate")) as
|
|
| 52 |
with gr.TabItem("🎨 Görsel Oluştur"):
|
| 53 |
with gr.Row():
|
| 54 |
with gr.Column():
|
| 55 |
-
inp = gr.Textbox(label="Görsel Tarifi (İngilizce)", placeholder="
|
| 56 |
btn = gr.Button("Görseli Oluştur ✨", variant="primary")
|
| 57 |
with gr.Column():
|
| 58 |
-
out = gr.Image(label="Sonuç"
|
| 59 |
|
| 60 |
btn.click(fn=image_fn, inputs=inp, outputs=out)
|
| 61 |
|
|
|
|
| 26 |
def image_fn(prompt):
|
| 27 |
if not prompt: return None
|
| 28 |
try:
|
| 29 |
+
return client.text_to_image(prompt, model="stabilityai/stable-diffusion-xl-base-1.0")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
except Exception as e:
|
| 31 |
+
return None
|
| 32 |
+
|
| 33 |
+
# Logo HTML yapısı (Maindai.jpg dosyasının Space içinde yüklü olduğunu varsayıyoruz)
|
| 34 |
+
logo_html = """
|
| 35 |
+
<div style="display: flex; justify-content: center; align-items: center; margin-bottom: 20px;">
|
| 36 |
+
<img src="file/Maindai.jpg" style="width: 120px; border-radius: 50%; box-shadow: 0 0 20px #38bdf8;">
|
| 37 |
+
<h1 style="margin-left: 20px; color: #38bdf8; font-family: sans-serif;">Maind AI Studio</h1>
|
| 38 |
+
</div>
|
| 39 |
+
"""
|
| 40 |
|
|
|
|
| 41 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", neutral_hue="slate")) as demo:
|
| 42 |
+
# Logoyu en üste ekliyoruz
|
| 43 |
+
gr.HTML(logo_html)
|
| 44 |
|
| 45 |
with gr.Tabs():
|
| 46 |
with gr.TabItem("💬 Akıllı Sohbet"):
|
|
|
|
| 49 |
with gr.TabItem("🎨 Görsel Oluştur"):
|
| 50 |
with gr.Row():
|
| 51 |
with gr.Column():
|
| 52 |
+
inp = gr.Textbox(label="Görsel Tarifi (İngilizce)", placeholder="A futuristic neon city...")
|
| 53 |
btn = gr.Button("Görseli Oluştur ✨", variant="primary")
|
| 54 |
with gr.Column():
|
| 55 |
+
out = gr.Image(label="Sonuç")
|
| 56 |
|
| 57 |
btn.click(fn=image_fn, inputs=inp, outputs=out)
|
| 58 |
|