dattarij commited on
Commit
ddc2866
·
verified ·
1 Parent(s): 16dc00b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import gradio as gr
3
  from PIL import Image
 
4
 
5
  # Define global paths
6
  BASE_PATH = "ContraCLIP/experiments/wip/"
@@ -47,8 +48,9 @@ def display_interactive_plot(latent_code):
47
  html_file = os.path.join(LATENT_CODES_DIR, latent_code, f"interactive_latent_space_{latent_code}.html")
48
  if not os.path.exists(html_file):
49
  return f"Interactive file not found: {html_file}"
50
- with open(html_file, "r") as file:
51
- return file.read()
 
52
 
53
  # Gradio Interface
54
  def build_interface():
 
1
  import os
2
  import gradio as gr
3
  from PIL import Image
4
+ import json
5
 
6
  # Define global paths
7
  BASE_PATH = "ContraCLIP/experiments/wip/"
 
48
  html_file = os.path.join(LATENT_CODES_DIR, latent_code, f"interactive_latent_space_{latent_code}.html")
49
  if not os.path.exists(html_file):
50
  return f"Interactive file not found: {html_file}"
51
+ # Embed the HTML file using an iframe
52
+ iframe = f'<iframe src="{html_file}" width="100%" height="600px" style="border:none;"></iframe>'
53
+ return iframe
54
 
55
  # Gradio Interface
56
  def build_interface():