bernardo-de-almeida commited on
Commit
c971cfe
·
1 Parent(s): ca5dbaa

fix: margins of plot

Browse files
Files changed (2) hide show
  1. app.py +1 -10
  2. style.css +14 -0
app.py CHANGED
@@ -219,15 +219,6 @@ def _make_tracks_figure(
219
  return fig
220
 
221
 
222
- def _save_fig_png(fig) -> str:
223
- """Save plotly figure as PNG."""
224
- tmpdir = tempfile.gettempdir()
225
- out_path = os.path.join(tmpdir, f"ntv3_tracks_{uuid.uuid4().hex}.png")
226
- # Plotly figures can be saved directly as PNG
227
- fig.write_image(out_path, width=1200, height=fig.layout.height, scale=2)
228
- return out_path
229
-
230
-
231
  # Cache track lists per species so search is instant after first load
232
  _BIGWIG_CACHE: dict[str, list[str]] = {}
233
 
@@ -1079,7 +1070,7 @@ with gr.Blocks(title="NTv3 Tracks Demo") as demo:
1079
  btn = gr.Button("Predict", elem_id="predict_btn")
1080
 
1081
  predictions_heading = gr.Markdown(
1082
- "## NTv3 predictions for selected tracks and elements", visible=False
1083
  )
1084
  predictions_note = gr.Markdown(
1085
  "Note: NTv3 predictions are for the 37.5% center of the input sequence.",
 
219
  return fig
220
 
221
 
 
 
 
 
 
 
 
 
 
222
  # Cache track lists per species so search is instant after first load
223
  _BIGWIG_CACHE: dict[str, list[str]] = {}
224
 
 
1070
  btn = gr.Button("Predict", elem_id="predict_btn")
1071
 
1072
  predictions_heading = gr.Markdown(
1073
+ "# NTv3 predictions for selected tracks and elements\n\n", visible=False
1074
  )
1075
  predictions_note = gr.Markdown(
1076
  "Note: NTv3 predictions are for the 37.5% center of the input sequence.",
style.css CHANGED
@@ -24,11 +24,25 @@ body, .gradio-container {
24
  position: relative;
25
  width: 100% !important;
26
  max-width: 100% !important;
 
 
 
27
  }
28
  #tracks_plot .wrap,
29
  #tracks_plot .plot-container {
30
  width: 100% !important;
31
  max-width: 100% !important;
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
 
 
24
  position: relative;
25
  width: 100% !important;
26
  max-width: 100% !important;
27
+ display: flex !important;
28
+ justify-content: center !important;
29
+ align-items: center !important;
30
  }
31
  #tracks_plot .wrap,
32
  #tracks_plot .plot-container {
33
  width: 100% !important;
34
  max-width: 100% !important;
35
+ display: flex !important;
36
+ justify-content: center !important;
37
+ align-items: center !important;
38
+ }
39
+
40
+ /* Center the actual plotly plot */
41
+ #tracks_plot .js-plotly-plot,
42
+ #tracks_plot .plotly,
43
+ #tracks_plot [class*="plotly"] {
44
+ margin: 0 auto !important;
45
+ display: block !important;
46
  }
47
 
48