Skip to content

Commit

Permalink
add warn info to web
Browse files Browse the repository at this point in the history
  • Loading branch information
creeponsky committed Apr 9, 2023
1 parent 4dc45d9 commit 53ca8e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ $(document).ready(function () {
$('#upload-form').submit();
});

// Show loading indicator when processing points
$('#process-points').on('click', function () {
$("#process-points").on("click", function () {
const points = getPoints();
if (points.length === 0) {
$("#no-points-warning").show();
return;
} else {
$("#no-points-warning").hide();
}
$('#loading').show();
sendPoints();
});
Expand All @@ -40,6 +46,10 @@ $(document).ready(function () {
console.log('Cleared all points');
});

function getPoints() {
return points;
}

function displayProcessedImg(imagePath: string = '', originalWidth: number, originalHeight: number) {
const randomParam = '?rand=' + Math.random();
const src = '/processed_image/' + imagePath + randomParam;
Expand Down
8 changes: 7 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ <h1 class="text-center">Segment Anything</h1>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-md-12 text-center">
<p id="no-points-warning" class="text-danger" style="display: none;">请在图片上点击以生成输入点 / Please click on the image to generate input points</p>
</div>
</div>
</div>


<div class="row mt-4">
<div class="col-md-4">
Expand Down

0 comments on commit 53ca8e3

Please sign in to comment.