Skip to content

Commit

Permalink
fix no img preview with categories
Browse files Browse the repository at this point in the history
  • Loading branch information
Senopiece committed Apr 11, 2024
1 parent 0742e7b commit e56c491
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions frontend/src/routes/searchResults/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
let mapContainer; // DOM element to bind the map
let searchResults: SearchResultsStore | null;
let imageUrl: string;
searchResultsStore.subscribe(($searchResults) => {
searchResults = $searchResults;
if (searchResults?.type === 'image') {
imageUrl = URL.createObjectURL(searchResults.image);
}
});
onMount(() => {
Expand Down Expand Up @@ -57,6 +63,15 @@

<main>
{#if searchResults}
{#if searchResults?.type === 'image'}
<h1>Загруженное изображение</h1>
<img src={imageUrl} alt="Search image" />
{#each searchResults.res.categories as category}
<div>
<h2>{category.category} : {category.probability}</h2>
</div>
{/each}
{/if}
<h1>Результаты поиска</h1>
<div bind:this={mapContainer} class="map"></div>
{:else}
Expand Down

0 comments on commit e56c491

Please sign in to comment.