Zaherrr commited on
Commit
8c1382e
·
verified ·
1 Parent(s): ee8e8e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -15
app.py CHANGED
@@ -37,27 +37,16 @@ def display_example(index):
37
 
38
  # Modify the iframe to have a fixed height
39
  graph_html = graph_html.replace('height: 100vh;', 'height: 500px;')
40
-
41
- # Wrap the graph HTML in a div with fixed height but no scrolling
42
- # graph_html_with_style = f"""
43
- # <div style="height: 300px; justify-content: center; align-items: center;overflow-y: auto">
44
- # <div style=max-height: 300px;">
45
- # {graph_html}
46
- # </div>
47
- # </div>
48
- # """
49
- graph_html_with_style = graph_html
50
-
51
  # Convert graph_data to a formatted JSON string
52
  json_data = json.dumps(transformed_graph_data, indent=2)
53
 
54
- return img, graph_html_with_style, json_data, transformed_graph_data
55
 
56
  def create_interface():
57
- # with gr.Blocks(css="#graph-output {height: 200px; overflow: hidden;}") as demo:
58
  with gr.Blocks() as demo:
59
 
60
- gr.Markdown("# Knowledge Graph Visualizer")
61
 
62
  with gr.Row():
63
  index_slider = gr.Slider(
@@ -69,7 +58,7 @@ def create_interface():
69
 
70
  with gr.Row():
71
  image_output = gr.Image(type="pil", label="Image", height=500)
72
- graph_output = gr.HTML(label="Knowledge Graph")#, elem_id="graph-output")
73
 
74
  with gr.Row():
75
  json_output = gr.Code(language="json", label="Graph JSON Data")
 
37
 
38
  # Modify the iframe to have a fixed height
39
  graph_html = graph_html.replace('height: 100vh;', 'height: 500px;')
40
+
 
 
 
 
 
 
 
 
 
 
41
  # Convert graph_data to a formatted JSON string
42
  json_data = json.dumps(transformed_graph_data, indent=2)
43
 
44
+ return img, graph_html, json_data, transformed_graph_data
45
 
46
  def create_interface():
 
47
  with gr.Blocks() as demo:
48
 
49
+ gr.Markdown("# Knowledge Graph Visualizer for the [Zaherrr/OOP_KG_Dataset](https://huggingface.co/datasets/Zaherrr/OOP_KG_Dataset)")
50
 
51
  with gr.Row():
52
  index_slider = gr.Slider(
 
58
 
59
  with gr.Row():
60
  image_output = gr.Image(type="pil", label="Image", height=500)
61
+ graph_output = gr.HTML(label="Knowledge Graph")
62
 
63
  with gr.Row():
64
  json_output = gr.Code(language="json", label="Graph JSON Data")