Rooni commited on
Commit
03b66c4
1 Parent(s): c589b78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -5,6 +5,8 @@ import urllib.parse
5
  import logging
6
  from PIL import Image
7
  from io import BytesIO
 
 
8
 
9
  # Настройка логирования
10
  logging.basicConfig(level=logging.INFO)
@@ -63,6 +65,11 @@ def generate_image(prompt, style, width, height, seed):
63
  "Тропический лес": "tropical rainforest style, lush vegetation, detailed textures, vibrant colors",
64
  "Экспериментальный": "experimental style, abstract, unconventional, detailed patterns, vibrant colors"
65
  }
 
 
 
 
 
66
 
67
  prompt = style_tags.get(style, "") + ". " + prompt if style_tags.get(style, "") else prompt
68
  prompt = prompt.strip()
 
5
  import logging
6
  from PIL import Image
7
  from io import BytesIO
8
+ from deep_translator import GoogleTranslator
9
+ from langdetect import detect
10
 
11
  # Настройка логирования
12
  logging.basicConfig(level=logging.INFO)
 
65
  "Тропический лес": "tropical rainforest style, lush vegetation, detailed textures, vibrant colors",
66
  "Экспериментальный": "experimental style, abstract, unconventional, detailed patterns, vibrant colors"
67
  }
68
+
69
+ language = detect(prompt)
70
+
71
+ if language != 'en':
72
+ prompt = GoogleTranslator(source=language, target='en').translate(prompt)
73
 
74
  prompt = style_tags.get(style, "") + ". " + prompt if style_tags.get(style, "") else prompt
75
  prompt = prompt.strip()