-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c999d66
commit 4928903
Showing
4 changed files
with
137 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use client"; | ||
|
||
export default function DetectedObjectsList({ detectedObjects }) { | ||
return ( | ||
<div className="mt-4"> | ||
<h2 className="text-lg font-semibold mb-2">Detected Objects:</h2> | ||
<ul className="space-y-2"> | ||
{detectedObjects.map((obj, index) => ( | ||
<li | ||
key={index} | ||
className="flex items-center justify-between p-2 bg-gray-100 dark:bg-gray-800 rounded" | ||
> | ||
<span className="font-medium">{obj.class}</span> | ||
<span className="text-sm text-muted-foreground"> | ||
{(obj.score * 100).toFixed(2)}% | ||
</span> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"use client"; | ||
|
||
import { Upload, Zap } from "lucide-react"; | ||
import { Button } from "@/components/ui/button"; | ||
|
||
export default function ImageUploader({ | ||
handleFileChange, | ||
startDetection, | ||
isDisabled, | ||
}) { | ||
return ( | ||
<div className="space-y-4"> | ||
<div className="flex items-center justify-center w-full"> | ||
<label | ||
htmlFor="image-upload" | ||
className="flex flex-col items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600" | ||
> | ||
<div className="flex flex-col items-center justify-center pt-5 pb-6"> | ||
<Upload className="w-8 h-8 mb-4 text-gray-500 dark:text-gray-400" /> | ||
<p className="mb-2 text-sm text-gray-500 dark:text-gray-400"> | ||
<span className="font-semibold">Click to upload</span> or drag and | ||
drop | ||
</p> | ||
<p className="text-xs text-gray-500 dark:text-gray-400"> | ||
PNG, JPG or GIF (MAX. 800x400px) | ||
</p> | ||
</div> | ||
<input | ||
id="image-upload" | ||
type="file" | ||
className="hidden" | ||
onChange={handleFileChange} | ||
accept="image/*" | ||
/> | ||
</label> | ||
</div> | ||
|
||
<Button onClick={startDetection} disabled={isDisabled} className="w-full"> | ||
<Zap className="w-4 h-4 mr-2" /> | ||
Start Detection | ||
</Button> | ||
</div> | ||
); | ||
} |