DGSpitzer commited on
Commit
fffc6ae
1 Parent(s): fbdf6d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -84,8 +84,8 @@ def generate_track_by_prompt(prompt):
84
  img_to_text = gr.Blocks.load(name="spaces/fffiloni/CLIP-Interrogator-2")
85
  #text_to_music = gr.Interface.load("spaces/fffiloni/text-2-music")
86
 
87
- language_translation_model = hub.Module(name='baidu_translate')
88
- language_recognition_model = hub.Module(name='baidu_language_recognition')
89
 
90
  # style_list = ['古风', '油画', '水彩', '卡通', '二次元', '浮世绘', '蒸汽波艺术', 'low poly', '像素风格', '概念艺术', '未来主义', '赛博朋克', '写实风格', '洛丽塔风格', '巴洛克风格', '超现实主义', '默认']
91
  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', 'Detailed']
@@ -115,9 +115,10 @@ def translate_language(text_prompts):
115
  try:
116
  count += 1
117
  tips_text = None
118
- language_code = language_recognition_model.recognize(text_prompts)
 
119
  if language_code != 'en':
120
- text_prompts = language_translation_model.translate(text_prompts, language_code, 'en')
121
  except Exception as e:
122
  error_text = str(e)
123
  return {status_text:error_text, language_tips_text:gr.update(visible=False), translated_language:text_prompts, trigger_component: gr.update(value=count, visible=False)}
 
84
  img_to_text = gr.Blocks.load(name="spaces/fffiloni/CLIP-Interrogator-2")
85
  #text_to_music = gr.Interface.load("spaces/fffiloni/text-2-music")
86
 
87
+ #language_translation_model = hub.Module(name='baidu_translate')
88
+ #language_recognition_model = hub.Module(name='baidu_language_recognition')
89
 
90
  # style_list = ['古风', '油画', '水彩', '卡通', '二次元', '浮世绘', '蒸汽波艺术', 'low poly', '像素风格', '概念艺术', '未来主义', '赛博朋克', '写实风格', '洛丽塔风格', '巴洛克风格', '超现实主义', '默认']
91
  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', 'Detailed']
 
115
  try:
116
  count += 1
117
  tips_text = None
118
+ #language_code = language_recognition_model.recognize(text_prompts)
119
+ language_code = 'en'
120
  if language_code != 'en':
121
+ #text_prompts = language_translation_model.translate(text_prompts, language_code, 'en')
122
  except Exception as e:
123
  error_text = str(e)
124
  return {status_text:error_text, language_tips_text:gr.update(visible=False), translated_language:text_prompts, trigger_component: gr.update(value=count, visible=False)}