audrey06100 commited on
Commit
068ad16
·
1 Parent(s): 98ead68
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -63,10 +63,7 @@ observe_js = """
63
  entries.forEach((entry) => {
64
  const target = entry.target;
65
  const newWidth = entry.contentRect.width;
66
-
67
- target.style.backgroundSize = `${newWidth}px`;
68
  target.style.setProperty("--channel-indicator-size", `${newWidth*0.025}px`);
69
- target.style.setProperty("--channel-name-size", `${newWidth*0.035}px`);
70
  });
71
  });
72
  observer.observe(document.querySelector("#radio-group > div:nth-of-type(2)"));
@@ -89,9 +86,7 @@ init_js = """
89
  }else return;
90
 
91
  const div = document.querySelector(selector);
92
- const divWidth = div.clientWidth;
93
- div.style.setProperty("--channel-indicator-size", `${divWidth*0.025}px`);
94
- div.style.setProperty("--channel-name-size", `${divWidth*0.035}px`);
95
 
96
  // add figure of the input montage
97
  div.style.cssText = `
@@ -100,7 +95,7 @@ init_js = """
100
  aspect-ratio: 1;
101
  background-image: url("file=${stage1_info.fileNames.originalMontage}");
102
  background-position: left bottom;
103
- background-size: ${divWidth}px;
104
  `;
105
 
106
  // move the radios/checkboxes
@@ -123,7 +118,7 @@ init_js = """
123
  `;
124
  });
125
 
126
- // add indication for the empty tpl_channels
127
  name = stage1_info.emptyTemplate[0];
128
  left = channel_info.templateDict[name].css_position[0];
129
  bottom = channel_info.templateDict[name].css_position[1];
@@ -146,7 +141,7 @@ init_js = """
146
  z-index: 1;
147
  left: ${left+2.7}%;
148
  bottom: ${bottom}%;
149
- font-size: var(--channel-name-size);
150
  font-weight: 900;
151
  color: red;
152
  }
@@ -213,7 +208,7 @@ update_js = """
213
  z-index: 1;
214
  left: ${left+2.7}%;
215
  bottom: ${bottom}%;
216
- font-size: var(--channel-name-size);
217
  font-weight: 900;
218
  color: red;
219
  }
@@ -815,7 +810,7 @@ with gr.Blocks(js=observe_js, delete_cache=(3600, 3600)) as demo:
815
  stage2_info["errorFlag"] = True
816
  return {stage2_json : stage2_info}
817
  elif samplerate.isdigit() == False:
818
- gr.Warning("The sampling rate needs to be an integer.")
819
  stage2_info["errorFlag"] = True
820
  return {stage2_json : stage2_info}
821
 
 
63
  entries.forEach((entry) => {
64
  const target = entry.target;
65
  const newWidth = entry.contentRect.width;
 
 
66
  target.style.setProperty("--channel-indicator-size", `${newWidth*0.025}px`);
 
67
  });
68
  });
69
  observer.observe(document.querySelector("#radio-group > div:nth-of-type(2)"));
 
86
  }else return;
87
 
88
  const div = document.querySelector(selector);
89
+ div.style.setProperty("--channel-indicator-size", `${div.clientWidth*0.025}px`);
 
 
90
 
91
  // add figure of the input montage
92
  div.style.cssText = `
 
95
  aspect-ratio: 1;
96
  background-image: url("file=${stage1_info.fileNames.originalMontage}");
97
  background-position: left bottom;
98
+ background-size: 100%;
99
  `;
100
 
101
  // move the radios/checkboxes
 
118
  `;
119
  });
120
 
121
+ // add indication for the first empty tpl_channel
122
  name = stage1_info.emptyTemplate[0];
123
  left = channel_info.templateDict[name].css_position[0];
124
  bottom = channel_info.templateDict[name].css_position[1];
 
141
  z-index: 1;
142
  left: ${left+2.7}%;
143
  bottom: ${bottom}%;
144
+ font-size: 1em;
145
  font-weight: 900;
146
  color: red;
147
  }
 
208
  z-index: 1;
209
  left: ${left+2.7}%;
210
  bottom: ${bottom}%;
211
+ font-size: 1em;
212
  font-weight: 900;
213
  color: red;
214
  }
 
810
  stage2_info["errorFlag"] = True
811
  return {stage2_json : stage2_info}
812
  elif samplerate.isdigit() == False:
813
+ gr.Warning("The sampling rate must be an integer.")
814
  stage2_info["errorFlag"] = True
815
  return {stage2_json : stage2_info}
816