adragos commited on
Commit
331093e
·
1 Parent(s): 67c73d3

remove header if iframed, remove gradio footer

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -270,6 +270,7 @@ js_code = """
270
  captcha.async = true;
271
  captcha.defer = true;
272
  document.head.appendChild(captcha);
 
273
  const discord_webhook = getStorage('discord_webhook')
274
  return [discord_webhook];
275
  })
@@ -280,6 +281,7 @@ css = """
280
  font-family: NeueMontreal;
281
  src: url("https://invariantlabs.ai/theme/NeueMontreal-Regular.otf") format("opentype");
282
  }
 
283
  """
284
 
285
  recaptcha_html = (
@@ -291,11 +293,10 @@ with gr.Blocks(
291
  theme=gr.themes.Soft(font="NeueMontreal"),
292
  css=css,
293
  ) as demo:
294
- # gr.Markdown("# Security Challenge by Invariant Labs - Summer'24")
295
  gr.HTML("""<h1 style="display: inline-block; vertical-align: middle;">
296
  <img src="https://invariantlabs.ai/theme/images/logo.svg" alt="logo" style="vertical-align: middle; display: inline-block;">
297
  <span style="vertical-align: middle;">invariantlabs.ai - Security Challenge Summer 2024</span>
298
- </h1>""")
299
 
300
  initial_table = initialize_table()
301
  playground_state = gr.State(initial_table)
 
270
  captcha.async = true;
271
  captcha.defer = true;
272
  document.head.appendChild(captcha);
273
+ if (window.self !== window.top) document.getElementById('invariant-header').style.display = 'none';
274
  const discord_webhook = getStorage('discord_webhook')
275
  return [discord_webhook];
276
  })
 
281
  font-family: NeueMontreal;
282
  src: url("https://invariantlabs.ai/theme/NeueMontreal-Regular.otf") format("opentype");
283
  }
284
+ footer {visibility: hidden}
285
  """
286
 
287
  recaptcha_html = (
 
293
  theme=gr.themes.Soft(font="NeueMontreal"),
294
  css=css,
295
  ) as demo:
 
296
  gr.HTML("""<h1 style="display: inline-block; vertical-align: middle;">
297
  <img src="https://invariantlabs.ai/theme/images/logo.svg" alt="logo" style="vertical-align: middle; display: inline-block;">
298
  <span style="vertical-align: middle;">invariantlabs.ai - Security Challenge Summer 2024</span>
299
+ </h1>""", elem_id="invariant-header")
300
 
301
  initial_table = initialize_table()
302
  playground_state = gr.State(initial_table)