Teotonix commited on
Commit
04c1ab9
·
verified ·
1 Parent(s): b15336a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -25,13 +25,23 @@ def chat_fn(message, history):
25
  yield f"Hata: {str(e)}"
26
 
27
  def image_fn(prompt):
28
- if not prompt: return None
 
 
 
29
  try:
30
- # Görsel üretme (SDXL Turbo)
31
- return client.text_to_image(prompt, model="stabilityai/sdxl-turbo")
32
  except Exception as e:
33
- print(f"Görsel Hatası: {e}")
34
- return None
 
 
 
 
 
 
 
35
 
36
  # Arayüz
37
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
 
25
  yield f"Hata: {str(e)}"
26
 
27
  def image_fn(prompt):
28
+ if not prompt:
29
+ return None
30
+
31
+ # 1. Deneme: En hızlı model (SDXL Turbo)
32
  try:
33
+ image = client.text_to_image(prompt, model="stabilityai/sdxl-turbo")
34
+ return image
35
  except Exception as e:
36
+ print(f"SDXL Turbo Hatası: {e}. Yedek modele geçiliyor...")
37
+
38
+ # 2. Deneme: En kararlı yedek model (Stable Diffusion v1.5)
39
+ try:
40
+ image = client.text_to_image(prompt, model="runwayml/stable-diffusion-v1-5")
41
+ return image
42
+ except Exception as e2:
43
+ print(f"Yedek Model Hatası: {e2}")
44
+ return None
45
 
46
  # Arayüz
47
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo: