Omnibus commited on
Commit
e16df51
1 Parent(s): e7faec5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -215,7 +215,7 @@ def preview_img(im):
215
  im = f'https:{im}'
216
  out = f"""<body><div><img src={im}></div></body>"""
217
  print(out)
218
- return out
219
  def prepare_card(url,title,description,img):
220
 
221
  with open("template.html", "r") as f:
@@ -229,7 +229,7 @@ def prepare_card(url,title,description,img):
229
  #with open("ai.html", "w") as f:
230
  # f.write(app)
231
  #files.append("ai.html")
232
- return(app)
233
 
234
  with gr.Blocks() as app:
235
  gr.HTML("""<h1>Interactive Social Media Card Maker</h1>""")
@@ -264,12 +264,13 @@ with gr.Blocks() as app:
264
  prepare_btn=gr.Button("Prepare Card")
265
  bld_btn=gr.Button("Build Card")
266
  prepared_html = gr.Textbox(max_lines=50)
 
267
 
268
  app.load(None,None,link_list,js=load_js)
269
  app.load(None,None,link_list,js=link_js)
270
  grab_im_url_btn.click(None,None,[link_list],js=link_js)
271
- preview_image_btn.click(preview_img,link_list,img_card)
272
- prepare_btn.click(prepare_card,[input,title,description,link_list],[prepared_html])
273
  #images.change(update_im,None,link_list,trigger_mode="multiple",js=link_js)
274
  search_btn.click(search_fn,[search_box,num_return],output)
275
  btn.click(first,None,output).then(test_single,input,output).then(details_fn,input,[details,images,title,description])
 
215
  im = f'https:{im}'
216
  out = f"""<body><div><img src={im}></div></body>"""
217
  print(out)
218
+ return out,im
219
  def prepare_card(url,title,description,img):
220
 
221
  with open("template.html", "r") as f:
 
229
  #with open("ai.html", "w") as f:
230
  # f.write(app)
231
  #files.append("ai.html")
232
+ return(app,app)
233
 
234
  with gr.Blocks() as app:
235
  gr.HTML("""<h1>Interactive Social Media Card Maker</h1>""")
 
264
  prepare_btn=gr.Button("Prepare Card")
265
  bld_btn=gr.Button("Build Card")
266
  prepared_html = gr.Textbox(max_lines=50)
267
+ preview_html = gr.HTML("""""")
268
 
269
  app.load(None,None,link_list,js=load_js)
270
  app.load(None,None,link_list,js=link_js)
271
  grab_im_url_btn.click(None,None,[link_list],js=link_js)
272
+ preview_image_btn.click(preview_img,link_list,[img_card,link_list])
273
+ prepare_btn.click(prepare_card,[input,title,description,link_list],[prepared_html,preview_html])
274
  #images.change(update_im,None,link_list,trigger_mode="multiple",js=link_js)
275
  search_btn.click(search_fn,[search_box,num_return],output)
276
  btn.click(first,None,output).then(test_single,input,output).then(details_fn,input,[details,images,title,description])