Rooni commited on
Commit
c3bd5d7
·
1 Parent(s): 6929f38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -7,6 +7,8 @@ import os
7
  from io import BytesIO
8
  import html
9
  import re
 
 
10
 
11
 
12
 
@@ -157,6 +159,12 @@ for model_name in model_list:
157
 
158
 
159
  def txt2img(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
 
 
 
 
 
 
160
  result = prodia_client.generate({
161
  "prompt": prompt,
162
  "negative_prompt": negative_prompt,
 
7
  from io import BytesIO
8
  import html
9
  import re
10
+ from deep_translator import GoogleTranslator
11
+ from langdetect import detect
12
 
13
 
14
 
 
159
 
160
 
161
  def txt2img(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
162
+ language = detect(prompt)
163
+
164
+ if language == 'ru':
165
+ prompt = GoogleTranslator(source='ru', target='en').translate(prompt)
166
+ print(prompt)
167
+
168
  result = prodia_client.generate({
169
  "prompt": prompt,
170
  "negative_prompt": negative_prompt,