igashov commited on
Commit
81748f8
1 Parent(s): 4470746

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -36,17 +36,19 @@ HTML_TEMPLATE = """<!DOCTYPE html>
36
  </html>
37
  """
38
 
 
 
 
 
 
39
  def generate(input_file):
40
  try:
41
  path = input_file.name
42
  except:
43
  return 'Error: could not open the provided file'
44
 
45
- return f"""<iframe style="width: 100%; height: 700px" name="result" allow="midi; geolocation; microphone; camera;
46
- display-capture; encrypted-media;" sandbox="allow-modals allow-forms
47
- allow-scripts allow-same-origin allow-popups
48
- allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
49
- allowpaymentrequest="" frameborder="0" srcdoc='{HTML_TEMPLATE}'></iframe>"""
50
 
51
 
52
  demo = gr.Blocks()
 
36
  </html>
37
  """
38
 
39
+ IFRAME_TEMPLATE = """<iframe style="width: 100%; height: 700px" name="result" allow="midi; geolocation; microphone; camera;
40
+ display-capture; encrypted-media;" sandbox="allow-modals allow-forms allow-scripts allow-same-origin allow-popups
41
+ allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
42
+ allowpaymentrequest="" frameborder="0" srcdoc='{html}'></iframe>"""
43
+
44
  def generate(input_file):
45
  try:
46
  path = input_file.name
47
  except:
48
  return 'Error: could not open the provided file'
49
 
50
+ html = HTML_TEMPLATE
51
+ return IFRAME_TEMPLATE.format(html=html)
 
 
 
52
 
53
 
54
  demo = gr.Blocks()