Omnibus commited on
Commit
767f570
·
verified ·
1 Parent(s): fc3180c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -405,13 +405,18 @@ css="""
405
 
406
 
407
  def mm(graph,zoom):
408
- code_out=""
 
 
 
 
 
409
  for ea in graph.split("\n"):
410
  code=ea.strip().strip("\n")
411
  code_out+=code
412
  #out_html=f'''<div><iframe src="https://omnibus-mermaid-script.static.hf.space/index.html?mermaid={code_out}&rand={random.randint(1,1111111111)}" height="500" width="500"></iframe></div>'''
413
  out_html=f'''<div id="wrap"><iframe id="frame" src="https://omnibus-mermaid-script.static.hf.space/index.html?mermaid={code_out}" height="500" width="500"></iframe></div>'''
414
- return gr.update(out_html,css=css.replace("$ZOOM",str(zoom)))
415
 
416
  def summarize(inp,history,data=None,files=None,directory=None,url=None,pdf_url=None,pdf_batch=None):
417
  json_box=[]
@@ -521,8 +526,8 @@ def clear_fn():
521
 
522
  def zoom_update(inp):
523
  this.clear()
524
- this.update(str(inp))
525
-
526
 
527
  with gr.Blocks() as app:
528
  gr.HTML("""<center><h1>Mixtral 8x7B TLDR Summarizer + Web</h1><h3>Summarize Data of unlimited length</h3>""")
@@ -559,7 +564,7 @@ with gr.Blocks() as app:
559
  #text=gr.JSON()
560
 
561
  #zoom_btn.change(zoom_update,zoom_btn,None)
562
- upd_button.click(mm,[e_box,zoom_btn],m_box)
563
  #inp_query.change(search_models,inp_query,models_dd)
564
  clear_btn.click(clear_fn,None,[prompt,chatbot])
565
 
 
405
 
406
 
407
  def mm(graph,zoom):
408
+ css="""
409
+ #wrap { width: 100%; height: 100%; padding: 0; overflow: auto; };
410
+ #frame { width: 100%; border: 1px solid black; };
411
+ #frame { zoom: $ZOOM; -moz-transform: scale($ZOOM); -moz-transform-origin: 0 0; };
412
+ """.replace("$ZOOM",zoom)
413
+ code_out=f"<style>{css}</style>"
414
  for ea in graph.split("\n"):
415
  code=ea.strip().strip("\n")
416
  code_out+=code
417
  #out_html=f'''<div><iframe src="https://omnibus-mermaid-script.static.hf.space/index.html?mermaid={code_out}&rand={random.randint(1,1111111111)}" height="500" width="500"></iframe></div>'''
418
  out_html=f'''<div id="wrap"><iframe id="frame" src="https://omnibus-mermaid-script.static.hf.space/index.html?mermaid={code_out}" height="500" width="500"></iframe></div>'''
419
+ return gr.update(out_html)
420
 
421
  def summarize(inp,history,data=None,files=None,directory=None,url=None,pdf_url=None,pdf_batch=None):
422
  json_box=[]
 
526
 
527
  def zoom_update(inp):
528
  this.clear()
529
+ this.append(str(inp))
530
+ return gr.update()
531
 
532
  with gr.Blocks() as app:
533
  gr.HTML("""<center><h1>Mixtral 8x7B TLDR Summarizer + Web</h1><h3>Summarize Data of unlimited length</h3>""")
 
564
  #text=gr.JSON()
565
 
566
  #zoom_btn.change(zoom_update,zoom_btn,None)
567
+ upd_button.click(mm,[e_box,zoom_btn],[m_box)
568
  #inp_query.change(search_models,inp_query,models_dd)
569
  clear_btn.click(clear_fn,None,[prompt,chatbot])
570