Teotonix commited on
Commit
e75784e
·
verified ·
1 Parent(s): 0dd8ac6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -17
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
- # En kararlı ve yeni model olan FLUX veya SDXL'i doğrudan API ile çağırıyoruz
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
- # Eğer ilk model hata verirse, en temel modele dön
38
- try:
39
- return client.text_to_image(prompt, model="runwayml/stable-diffusion-v1-5")
40
- except:
41
- print(f"Görsel Hatası: {e}")
42
- return None
 
 
 
43
 
44
- # Arayüz (Modern Dark Tema)
45
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", neutral_hue="slate")) as demo:
46
- gr.Markdown("<h1 style='text-align: center; color: #38bdf8;'>🚀 Maind AI Studio</h1>")
 
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="Örn: A futuristic car in Istanbul...")
56
  btn = gr.Button("Görseli Oluştur ✨", variant="primary")
57
  with gr.Column():
58
- out = gr.Image(label="Sonuç", type="pil") # PIL formatı daha garantidir
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