DGSpitzer commited on
Commit
2dbde8d
1 Parent(s): 72ad0e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -28,8 +28,8 @@ img_to_text = gr.Blocks.load(name="spaces/pharma/CLIP-Interrogator")
28
  language_translation_model = hub.Module(name='baidu_translate')
29
  language_recognition_model = hub.Module(name='baidu_language_recognition')
30
 
31
- style_list = ['古风', '油画', '水彩', '卡通', '二次元', '浮世绘', '蒸汽波艺术', 'low poly', '像素风格', '概念艺术', '未来主义', '赛博朋克', '写实风格', '洛丽塔风格', '巴洛克风格', '超现实主义', '探索无限']
32
- style_list_EN = ['Chinese Ancient Style', 'Oil painting', 'Watercolor', 'Cartoon', 'Anime', 'Ukiyoe', 'Vaporwave', 'low poly', 'Pixel Style', 'Conceptual Art', 'Futurism', 'Cyberpunk', 'Realistic style', 'Lolita style', 'Baroque style', 'Surrealism', '']
33
 
34
  tips = {"en": "Tips: The input text will be translated into Chinese for generation",
35
  "jp": "ヒント: 入力テキストは生成のために中国語に翻訳されます",
@@ -55,8 +55,8 @@ def translate_language(text_prompts):
55
  count += 1
56
  tips_text = None
57
  language_code = language_recognition_model.recognize(text_prompts)
58
- if language_code != 'zh':
59
- text_prompts = language_translation_model.translate(text_prompts, language_code, 'zh')
60
  except Exception as e:
61
  error_text = str(e)
62
  return {status_text:error_text, language_tips_text:gr.update(visible=False)}
@@ -119,7 +119,7 @@ def merge_video(music, image):
119
  fps = 12
120
  slide_time = audio_length
121
  fourcc = cv2.VideoWriter.fourcc(*'MJPG')
122
- out = cv2.VideoWriter(file_name, fourcc, fps, (1024, 1024))
123
 
124
  # for image in img_list:
125
  # cv_img = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
 
28
  language_translation_model = hub.Module(name='baidu_translate')
29
  language_recognition_model = hub.Module(name='baidu_language_recognition')
30
 
31
+ style_list = ['古风', '油画', '水彩', '卡通', '二次元', '浮世绘', '蒸汽波艺术', 'low poly', '像素风格', '概念艺术', '未来主义', '赛博朋克', '写实风格', '洛丽塔风格', '巴洛克风格', '超现实主义', '默认']
32
+ style_list_EN = ['Chinese Ancient Style', 'Oil painting', 'Watercolor', 'Cartoon', 'Anime', 'Ukiyoe', 'Vaporwave', 'low poly', 'Pixel Style', 'Conceptual Art', 'Futurism', 'Cyberpunk', 'Realistic style', 'Lolita style', 'Baroque style', 'Surrealism', 'Default']
33
 
34
  tips = {"en": "Tips: The input text will be translated into Chinese for generation",
35
  "jp": "ヒント: 入力テキストは生成のために中国語に翻訳されます",
 
55
  count += 1
56
  tips_text = None
57
  language_code = language_recognition_model.recognize(text_prompts)
58
+ if language_code != 'en':
59
+ text_prompts = language_translation_model.translate(text_prompts, language_code, 'en')
60
  except Exception as e:
61
  error_text = str(e)
62
  return {status_text:error_text, language_tips_text:gr.update(visible=False)}
 
119
  fps = 12
120
  slide_time = audio_length
121
  fourcc = cv2.VideoWriter.fourcc(*'MJPG')
122
+ out = cv2.VideoWriter(file_name, fourcc, fps, (512, 512))
123
 
124
  # for image in img_list:
125
  # cv_img = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)