Skip to content

Commit

Permalink
fix: docker compose support
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonwy committed Jul 14, 2024
1 parent de11a31 commit 948544f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ services:
dockerfile: Dockerfile
ports:
- 3001:3000
environment:
- NEXT_PUBLIC_API_URL=http://lens-api:5000
restart: always
depends_on:
- lens-api
5 changes: 3 additions & 2 deletions frontend/components/image-classification.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import Config from '@/lib/config';
import {
ClassificationProduct,
ClassificationProductDescription,
Expand Down Expand Up @@ -39,7 +40,7 @@ export default function ImageClassification() {
const formData = new FormData();
formData.append('file', image);

fetch('http://localhost:3002/classify', {
fetch(`${Config.apiUrl}/classify`, {
method: 'POST',
body: formData,
}).then(async (response) => {
Expand Down Expand Up @@ -128,7 +129,7 @@ function ClassificationCard({ data }: { data: ClassificationProduct }) {
};

return (
<div className="bg-white rounded-lg border-gray-200 border-[1px] p-4 max-h-32 overflow-auto">
<div className="bg-white rounded-lg border-gray-200 border-[1px] p-4 max-h-64 overflow-auto">
<h2 className="text-lg font-bold">{cardTitle[data.data_description]}</h2>
{buildCard}
</div>
Expand Down
5 changes: 5 additions & 0 deletions frontend/lib/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default class Config {
static get apiUrl(): string {
return process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3002';
}
}

0 comments on commit 948544f

Please sign in to comment.