xribene commited on
Commit
2e08fa9
·
1 Parent(s): 584b166

fixed pitchOffset bug

Browse files
__pycache__/alphaM21utils.cpython-310.pyc CHANGED
Binary files a/__pycache__/alphaM21utils.cpython-310.pyc and b/__pycache__/alphaM21utils.cpython-310.pyc differ
 
app.py CHANGED
@@ -38,7 +38,7 @@ def remove_spaces_except_between_plain_python(input_string):
38
  return result_string
39
 
40
 
41
- def forward(contextScore, pitchSlider, onsetDensitySlider, curveLp, densityLp):
42
  # parse notes
43
  # alphaTex = contextScore.strip().replace("\n", " ")
44
  alphaTex = " ".join(contextScore.split())
@@ -87,7 +87,7 @@ def forward(contextScore, pitchSlider, onsetDensitySlider, curveLp, densityLp):
87
  # f.write("check 3 \n")
88
  condOH_middleBar = (
89
  torch.tensor(
90
- np.array([1 if i == pitchSlider else 0 for i in range(condDims)]).reshape(1, condDims),
91
  )
92
  .unsqueeze(0)
93
  .float()
@@ -95,7 +95,7 @@ def forward(contextScore, pitchSlider, onsetDensitySlider, curveLp, densityLp):
95
  ) # parsedContextMeasure['irregGrid34']['condOH']
96
  onsetOffsetOH_middleBar = (
97
  torch.tensor(
98
- np.array([1 if i == onsetDensitySlider else 0 for i in range(condDims)]).reshape(
99
  1,
100
  condDims,
101
  ),
@@ -173,9 +173,7 @@ def process(contextScore, pitchSlider, rhythmSlider, canvas_components):
173
  plt.imsave("canvas.png", canvas)
174
  onsetDensitySlider = int(rhythmSlider) - 1
175
  pitchOffset = int(pitchSlider) - 1
176
- # image_bin2d = canvas
177
- # if len(canvas.shape > 2):
178
- np.unique(canvas)
179
  image_bin2d = get_binary_image(canvas)
180
  image_bin2d = validateBinaryImage(image_bin2d)
181
  count, labels = get_islands(image_bin2d)
 
38
  return result_string
39
 
40
 
41
+ def forward(contextScore, pitchOffset, onsetDensityOffset, curveLp, densityLp):
42
  # parse notes
43
  # alphaTex = contextScore.strip().replace("\n", " ")
44
  alphaTex = " ".join(contextScore.split())
 
87
  # f.write("check 3 \n")
88
  condOH_middleBar = (
89
  torch.tensor(
90
+ np.array([1 if i == pitchOffset else 0 for i in range(condDims)]).reshape(1, condDims),
91
  )
92
  .unsqueeze(0)
93
  .float()
 
95
  ) # parsedContextMeasure['irregGrid34']['condOH']
96
  onsetOffsetOH_middleBar = (
97
  torch.tensor(
98
+ np.array([1 if i == onsetDensityOffset else 0 for i in range(condDims)]).reshape(
99
  1,
100
  condDims,
101
  ),
 
173
  plt.imsave("canvas.png", canvas)
174
  onsetDensitySlider = int(rhythmSlider) - 1
175
  pitchOffset = int(pitchSlider) - 1
176
+ print(f"pitchOffset: {pitchOffset}, rhythmOffset: {onsetDensitySlider}")
 
 
177
  image_bin2d = get_binary_image(canvas)
178
  image_bin2d = validateBinaryImage(image_bin2d)
179
  count, labels = get_islands(image_bin2d)
canvas.png CHANGED
frontend/src/components/CanvasDL-Grid.vue CHANGED
@@ -172,7 +172,7 @@ function canvasMouseOut(e) {
172
  <div v-for="(slider, index) in canvasSliders" :key="slider.id" class="flex-1 p-2">
173
  <input v-model="sliderValues[index]" class="w-1/2" type="range" min="1" max="3">
174
  <div class="font-500">
175
- {{ slider.name }} - {{ sliderValues[index] }}
176
  </div>
177
  </div>
178
  </div>
 
172
  <div v-for="(slider, index) in canvasSliders" :key="slider.id" class="flex-1 p-2">
173
  <input v-model="sliderValues[index]" class="w-1/2" type="range" min="1" max="3">
174
  <div class="font-500">
175
+ {{ slider.name }} {{ sliderValues[index] }}
176
  </div>
177
  </div>
178
  </div>
frontend/src/views/DrawAndListen.vue CHANGED
@@ -27,8 +27,8 @@ async function connectToServer() {
27
  try {
28
  // app = await client('xribene/guitar-diff')
29
  // app = await client('https://xribene-guitar-diff.hf.space/--replicas/qmsjt/')
30
- // app = await client("http://127.0.0.1:7860/");
31
- app = await client("https://xribene-drawlistendemo.hf.space/--replicas/gix51/");
32
 
33
 
34
  }
 
27
  try {
28
  // app = await client('xribene/guitar-diff')
29
  // app = await client('https://xribene-guitar-diff.hf.space/--replicas/qmsjt/')
30
+ app = await client("http://127.0.0.1:7860/");
31
+ // app = await client("https://xribene-drawlistendemo.hf.space/--replicas/gix51/");
32
 
33
 
34
  }