Skip to content

Commit

Permalink
adding sample image
Browse files Browse the repository at this point in the history
  • Loading branch information
viraatdas committed Mar 24, 2024
1 parent ce21281 commit 6273c3d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion web-ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function App() {
<div className="App">
<header className="App-header">
<p className="description">
Welcome to the Colony Counter application. Upload images of petri
Welcome to Colony Counter. Upload images of petri
dishes to automatically count colonies.
</p>
<h1>Colony Counter</h1>
Expand Down
Binary file added web-ui/src/assets/sample_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions web-ui/src/components/ImageUpload.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import React, { useState, useRef } from "react";
import React, { useState, useRef, useEffect } from "react";
import { BeforeAfter } from "react-simple-before-after";
import sampleImage from "../assets/sample_1.png";

const countColoniesApi =
"https://colony-counter-c9342bb08f9c.herokuapp.com/count-colonies";
const ImageUpload = () => {
const [images, setImages] = useState([]); // Store the images for preview
const sample_image = {
url: sampleImage,
name: "sample_1.png",
};

const [images, setImages] = useState([sample_image]); // Store the images for preview
const [resultImages, setResultImages] = useState([]); // Store the processed images for preview
const [colonyCounts, setColonyCounts] = useState([]); // Store the colony counts for each image
const [selectedIndex, setSelectedIndex] = useState(0); // The index of the selected image
Expand All @@ -24,8 +30,7 @@ const ImageUpload = () => {

const handleSubmit = async () => {
if (images.length === 0) {
alert("Please select a file before submitting.");
return;
setImages([sample_image]);
}

// Initialize empty arrays to store results for each image
Expand Down Expand Up @@ -119,11 +124,7 @@ const ImageUpload = () => {
{colonyCount != null && (
<div>
<p>Colony Count: {colonyCount}</p>
<BeforeAfter
beforeImage={image.url}
afterImage={resultImage}
/* Other Props */
/>
<BeforeAfter beforeImage={image.url} afterImage={resultImage} />
</div>
)}
</div>
Expand Down

0 comments on commit 6273c3d

Please sign in to comment.