datasciencedojo commited on
Commit
71fdb6a
·
1 Parent(s): 163653e

Remove zoom functionality

Browse files
Files changed (1) hide show
  1. app.py +6 -23
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  import os
3
  os.system('python -m spacy download en_core_web_sm')
@@ -15,7 +16,7 @@ def render_dep_chart(doc):
15
  img.write(svg.encode())
16
  img.seek(0)
17
  b64 = base64.b64encode(img.read()).decode()
18
- return f"<img id='zoomable' class='zoomable-image' src='data:image/svg+xml;base64,{b64}'/>"
19
 
20
  def text_analysis(text):
21
  doc = nlp(text)
@@ -43,30 +44,12 @@ footer {display:none !important}
43
  --tw-bg-opacity: 1 !important;
44
  background-color: rgb(229,225,255) !important;
45
  }
46
- .zoomable-image {
47
- cursor: pointer;
48
  }
49
- .zoomed-image {
50
- position: fixed;
51
- top: 0;
52
- left: 0;
53
- width: 100%;
54
- height: 100%;
55
- object-fit: contain;
56
- z-index: 99999;
57
- background: rgba(0,0,0,0.8);
58
- }
59
- """
60
-
61
- js = """
62
- document.querySelectorAll('.zoomable-image').forEach((image) => {
63
- image.addEventListener('click', () => {
64
- image.classList.toggle('zoomed-image');
65
- });
66
- });
67
  """
68
 
69
- with gr.Blocks(title="Analyze Text | Data Science Dojo", css = css, js=js) as demo:
70
  with gr.Row():
71
  inp = gr.Textbox(placeholder="Enter text to analyze...", label="Input")
72
  btn = gr.Button("Analyze Text")
@@ -84,4 +67,4 @@ with gr.Blocks(title="Analyze Text | Data Science Dojo", css = css, js=js) as de
84
  ["It's the best time to execute the plan."],
85
  ], fn=text_analysis, inputs=inp, outputs=[table, visual1], cache_examples=True)
86
  btn.click(fn=text_analysis, inputs=inp, outputs=[table, visual1])
87
- demo.launch()
 
1
+ #100
2
  import gradio as gr
3
  import os
4
  os.system('python -m spacy download en_core_web_sm')
 
16
  img.write(svg.encode())
17
  img.seek(0)
18
  b64 = base64.b64encode(img.read()).decode()
19
+ return f"<img id='zoomable' src='data:image/svg+xml;base64,{b64}'/>"
20
 
21
  def text_analysis(text):
22
  doc = nlp(text)
 
44
  --tw-bg-opacity: 1 !important;
45
  background-color: rgb(229,225,255) !important;
46
  }
47
+ #zoomable{
48
+ cursor: pointer;
49
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  """
51
 
52
+ with gr.Blocks(title="Analyze Text | Data Science Dojo", css = css) as demo:
53
  with gr.Row():
54
  inp = gr.Textbox(placeholder="Enter text to analyze...", label="Input")
55
  btn = gr.Button("Analyze Text")
 
67
  ["It's the best time to execute the plan."],
68
  ], fn=text_analysis, inputs=inp, outputs=[table, visual1], cache_examples=True)
69
  btn.click(fn=text_analysis, inputs=inp, outputs=[table, visual1])
70
+ demo.launch()