承弱 commited on
Commit
9c7e39f
1 Parent(s): 2a9b067

fix javascript

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -63,20 +63,14 @@ def process(mode, prompt, texts, texts2, layout_radio, sort_radio, revise_pos, b
63
  is_t2i = 'true'
64
  block = gr.Blocks(css='css/style.css', theme=gr.themes.Soft()).queue()
65
 
66
- with open('javascript/bboxHint.js', 'r') as file:
67
- value = file.read()
68
- escaped_value = json.dumps(value)
69
 
70
  with block:
71
- block.load(fn=None,
72
- _js=f"""() => {{
73
- const script = document.createElement("script");
74
- const text = document.createTextNode({escaped_value});
75
- script.appendChild(text);
76
- document.head.appendChild(script);
77
- }}""")
78
  gr.HTML('<div style="text-align: center; margin: 20px auto;"> \
79
- <img id="banner" src="https://modelscope.cn/api/v1/studio/iic/mememaster/repo?Revision=master&FilePath=example_images/banner2.png" alt="anytext_meme"> <br> \
80
  [<a href="https://arxiv.org/abs/2311.03054" style="color:blue; font-size:18px;">arXiv</a>] \
81
  [<a href="https://github.com/tyxsspa/AnyText" style="color:blue; font-size:18px;">Code</a>] \
82
  [<a href="https://modelscope.cn/models/damo/cv_anytext_text_generation_editing/summary" style="color:blue; font-size:18px;">ModelScope</a>]\
@@ -270,4 +264,4 @@ with block:
270
  ips = [prompt, texts, texts2, layout_radio, sort_radio, revise_pos, base_model_path, lora_path_ratio, show_debug,img_count, ddim_steps, image_width, image_height, strength, cfg_scale, seed, eta, a_prompt, n_prompt]
271
  run_gen.click(fn=process, inputs=[gr.State('gen')] + ips, outputs=[result_gallery])
272
 
273
- block.launch(server_name='0.0.0.0',share=False, server_port=7687)
 
63
  is_t2i = 'true'
64
  block = gr.Blocks(css='css/style.css', theme=gr.themes.Soft()).queue()
65
 
66
+ #with open('javascript/bboxHint.js', 'r') as file:
67
+ # value = file.read()
68
+ #escaped_value = json.dumps(value)
69
 
70
  with block:
71
+ block.load(fn=None)
 
 
 
 
 
 
72
  gr.HTML('<div style="text-align: center; margin: 20px auto;"> \
73
+ <img id="banner" src="https://huggingface.co/spaces/martinxm/MemeMaster/resolve/main/example_images/banner2.png" alt="anytext_meme"> <br> \
74
  [<a href="https://arxiv.org/abs/2311.03054" style="color:blue; font-size:18px;">arXiv</a>] \
75
  [<a href="https://github.com/tyxsspa/AnyText" style="color:blue; font-size:18px;">Code</a>] \
76
  [<a href="https://modelscope.cn/models/damo/cv_anytext_text_generation_editing/summary" style="color:blue; font-size:18px;">ModelScope</a>]\
 
264
  ips = [prompt, texts, texts2, layout_radio, sort_radio, revise_pos, base_model_path, lora_path_ratio, show_debug,img_count, ddim_steps, image_width, image_height, strength, cfg_scale, seed, eta, a_prompt, n_prompt]
265
  run_gen.click(fn=process, inputs=[gr.State('gen')] + ips, outputs=[result_gallery])
266
 
267
+ block.launch(server_name='0.0.0.0',share=False, server_port=7687)