From b1c4cbbb948763fc4efb87321a4361eecd428379 Mon Sep 17 00:00:00 2001 From: dominikkawka Date: Sun, 21 Apr 2024 20:28:29 +0100 Subject: [PATCH] removed console.log --- README.md | 2 +- backend/loadRunModel.py | 2 +- frontend/src/api/api.js | 12 +----------- .../src/components/DragDropImage/dragDropImage.tsx | 6 ------ frontend/src/components/FileForm/FileForm.jsx | 4 ---- frontend/src/components/HomeStats/homeStats.tsx | 2 -- .../src/components/NavigationBar/NavigationBar.tsx | 1 - frontend/src/components/WebcamFeed/WebcamFeed.tsx | 7 ++----- frontend/src/pages/AboutPage.jsx | 2 -- frontend/src/pages/DogDescriptionPage.tsx | 3 --- frontend/src/pages/HistoryPage.tsx | 2 -- frontend/src/pages/signinPage.tsx | 1 - frontend/src/pages/signupPage.tsx | 2 -- 13 files changed, 5 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 69666b7..c27a5a7 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,4 @@ If you wish to use your GPU to build the model yourself, please follow [this gui #### Other -I haven't uploaded the model itself since there seems to be a bug with git lfs, when downloaded the model is corrupted. In backend, create a folder named model and insert the model from this [google drive download link](https://drive.google.com/file/d/1mxr1Mmtp8ZQqLGGpO7450eUxIrJlQlKk/view?usp=sharing). \ No newline at end of file +I haven't uploaded the model itself since there seems to be a bug with git lfs, when downloaded the model is corrupted. In backend, create a folder named model and insert the model from this [google drive download link](https://drive.google.com/file/d/1msjLsnz-Zqua8dRYwe3HL2ofQ36XA5GR/view?usp=sharing). \ No newline at end of file diff --git a/backend/loadRunModel.py b/backend/loadRunModel.py index 9d03008..33b2096 100644 --- a/backend/loadRunModel.py +++ b/backend/loadRunModel.py @@ -16,7 +16,7 @@ from backend import commonVariables as val def modelPrediction(dogBreedImage): - loadModel = load_model('model/InceptionV3-2.15-22Mar-122-Augmented.h5') #backend/model/InceptionV3-2.15-22Mar-122-Augmented.h5 + loadModel = load_model('backend/model/InceptionV3-2.15-22Mar-122-Augmented.h5') #backend/model/InceptionV3-2.15-22Mar-122-Augmented.h5 #convert image valueBreed = tf.keras.utils.load_img(dogBreedImage, target_size=(val.image_size,val.image_size)) diff --git a/frontend/src/api/api.js b/frontend/src/api/api.js index c159c20..5c221a1 100644 --- a/frontend/src/api/api.js +++ b/frontend/src/api/api.js @@ -8,7 +8,6 @@ const uploadImage = async (image) => { const response = await axios.post(`${import.meta.env.VITE_API_URL}/uploadImage`, formData); return response.data; } catch (error) { - console.error('Error uploading image:', error); throw error; } }; @@ -22,7 +21,6 @@ const getPrediction = async (imageName) => { }); return response.data; } catch (error) { - console.error('Error fetching prediction:', error); throw error; } }; @@ -36,10 +34,7 @@ const patchCorrectBreed = async (predictedBreed, imageName, actualBreed) => { }); return response.data; } catch (error) { - console.error('Error patching correct breed:', error); - console.log("prediction: "+ predictedBreed) - console.log("image name: "+ imageName) - console.log("actualBreed: "+ actualBreed) + throw error; } }; @@ -53,10 +48,6 @@ const patchUsernameToPrediction = async (predictedBreed, imageName, username) => }); return response.data; } catch (error) { - console.error('Error patching correct breed:', error); - console.log("prediction: "+ predictedBreed) - console.log("image name: "+ imageName) - console.log("username: "+ username) throw error; } } @@ -71,7 +62,6 @@ const loginUser = async (username, password) => { localStorage.setItem('token', response.data.access_token) sessionStorage.setItem('username', username) window.location.replace(`/`) - //console.log(response.data) return response.data } catch (error) { throw error diff --git a/frontend/src/components/DragDropImage/dragDropImage.tsx b/frontend/src/components/DragDropImage/dragDropImage.tsx index 4652810..17003b3 100644 --- a/frontend/src/components/DragDropImage/dragDropImage.tsx +++ b/frontend/src/components/DragDropImage/dragDropImage.tsx @@ -54,7 +54,6 @@ export default function DragDropImage() { setImagePreview(URL.createObjectURL(selectedImage)); } else { setUploadError('Unsupported file type. Please upload a PNG or JPEG image.') - console.error('Unsupported file type. Please upload a PNG or JPEG image.'); } }; @@ -68,7 +67,6 @@ export default function DragDropImage() { setConfidence2(parseFloat(response.secondConfidence) || 0); setPrediction3(response.thirdPredictedBreed || ''); setConfidence3(parseFloat(response.thirdConfidence) || 0); - console.log((confidence + confidence2 + confidence3)) } catch (error) { // Handle error } @@ -112,9 +110,6 @@ export default function DragDropImage() { if (response) { } } catch (error) { - //console.log("prediction: "+ prediction) - //console.log("image name: "+ image.name) - //console.log("actualBreed: "+ actualBreed) } }; @@ -252,7 +247,6 @@ export default function DragDropImage() { }); } else { setValue(newValue); - console.log('newValue: '+ JSON.stringify(newValue)) } }} filterOptions={(options, params) => { diff --git a/frontend/src/components/FileForm/FileForm.jsx b/frontend/src/components/FileForm/FileForm.jsx index 182ce60..4444560 100644 --- a/frontend/src/components/FileForm/FileForm.jsx +++ b/frontend/src/components/FileForm/FileForm.jsx @@ -55,9 +55,6 @@ function FileForm() { if (response) { } } catch (error) { - //console.log("prediction: "+ prediction) - //console.log("image name: "+ image.name) - //console.log("actualBreed: "+ actualBreed) } }; @@ -169,7 +166,6 @@ function FileForm() { }); } else { setValue(newValue); - console.log('newValue: '+ JSON.stringify(newValue)) } }} filterOptions={(options, params) => { diff --git a/frontend/src/components/HomeStats/homeStats.tsx b/frontend/src/components/HomeStats/homeStats.tsx index 7fadfa3..b32fdad 100644 --- a/frontend/src/components/HomeStats/homeStats.tsx +++ b/frontend/src/components/HomeStats/homeStats.tsx @@ -19,7 +19,6 @@ export default function HomeStats() { const fetchAllPredictions = async () => { try { const response = await axios.get(`${import.meta.env.VITE_API_URL}/allPredictions`); - console.log(response.data); setAmount(response.data.length); } catch (error) { setAmount(301) @@ -29,7 +28,6 @@ export default function HomeStats() { const fetchUserPredictions = async () => { try { const response = await axios.get(`${import.meta.env.VITE_API_URL}/allUsers`); - console.log(response.data); setUserAmount(response.data.length); } catch (error) { setUserAmount(301) diff --git a/frontend/src/components/NavigationBar/NavigationBar.tsx b/frontend/src/components/NavigationBar/NavigationBar.tsx index 4bfc1c1..e22be10 100644 --- a/frontend/src/components/NavigationBar/NavigationBar.tsx +++ b/frontend/src/components/NavigationBar/NavigationBar.tsx @@ -24,7 +24,6 @@ const SiteHeader = ({ }) => { const navigate = useNavigate(); let username = sessionStorage.getItem("username") - console.log("logged in as..." + username) const logout = () => { sessionStorage.removeItem("username") diff --git a/frontend/src/components/WebcamFeed/WebcamFeed.tsx b/frontend/src/components/WebcamFeed/WebcamFeed.tsx index 0d4d8ec..0a9456a 100644 --- a/frontend/src/components/WebcamFeed/WebcamFeed.tsx +++ b/frontend/src/components/WebcamFeed/WebcamFeed.tsx @@ -60,11 +60,10 @@ function WebcamFeed() { imageName: imageName, }) .then((r) => { - console.log(r.status); + //console.log(r.status); setProgressVisible(false); }) - .catch((e) => console.log(e)); - //console.log(splitImgMetaData); + .catch((e) => console.log('')); setViewPrediction(true) } catch (error) { setViewPrediction(true) @@ -81,7 +80,6 @@ function WebcamFeed() { setConfidence2(parseFloat(response.secondConfidence) || 0); setPrediction3(response.thirdPredictedBreed || ''); setConfidence3(parseFloat(response.thirdConfidence) || 0); - console.log((confidence + confidence2 + confidence3)) } catch (error) { // Handle error } @@ -241,7 +239,6 @@ function WebcamFeed() { }); } else { setValue(newValue); - console.log('newValue: '+ JSON.stringify(newValue)) } }} filterOptions={(options, params) => { diff --git a/frontend/src/pages/AboutPage.jsx b/frontend/src/pages/AboutPage.jsx index 6ab9e43..b5a8ea1 100644 --- a/frontend/src/pages/AboutPage.jsx +++ b/frontend/src/pages/AboutPage.jsx @@ -8,7 +8,6 @@ const AboutPage = () => { const fetchAllPredictions = async () => { try { const response = await axios.get(`${import.meta.env.VITE_API_URL}/allPredictions`); - console.log(response.data); setAmount(response.data.length); } catch (error) { setAmount("?") @@ -18,7 +17,6 @@ const AboutPage = () => { const fetchUserPredictions = async () => { try { const response = await axios.get(`${import.meta.env.VITE_API_URL}/allUsers`); - console.log(response.data); setUserAmount(response.data.length); } catch (error) { setUserAmount("?") diff --git a/frontend/src/pages/DogDescriptionPage.tsx b/frontend/src/pages/DogDescriptionPage.tsx index 474c852..b414462 100644 --- a/frontend/src/pages/DogDescriptionPage.tsx +++ b/frontend/src/pages/DogDescriptionPage.tsx @@ -42,7 +42,6 @@ const DogDescriptionPage: React.FC = () => { const result = await getDescription(breedName); setDescription(result); } catch (error) { - console.error('Error fetching description:', error); } }; @@ -57,10 +56,8 @@ const DogDescriptionPage: React.FC = () => { }, }); - console.log(response.data); return response.data; } catch (error) { - console.error('Error fetching description:', error); throw error; } }; diff --git a/frontend/src/pages/HistoryPage.tsx b/frontend/src/pages/HistoryPage.tsx index da4e8c6..42acaf3 100644 --- a/frontend/src/pages/HistoryPage.tsx +++ b/frontend/src/pages/HistoryPage.tsx @@ -18,7 +18,6 @@ const HistoryPage = () => { token: token }, }); - console.log(response.data); setPredictions(response.data); setProgressCircle(false) } catch (error) { @@ -34,7 +33,6 @@ const HistoryPage = () => { image: image } }) - console.log(response.data); await fetchUserPredictions() } catch (error) { await fetchUserPredictions() diff --git a/frontend/src/pages/signinPage.tsx b/frontend/src/pages/signinPage.tsx index 7b58764..5ef620e 100644 --- a/frontend/src/pages/signinPage.tsx +++ b/frontend/src/pages/signinPage.tsx @@ -35,7 +35,6 @@ export default function SignInSide() { } catch (error) { if (error instanceof AxiosError) { let errorMessage = error.response?.data.detail; - console.log(errorMessage) if (!username || !password) { setErrorMessage("Username or password cannot be empty"); } else { diff --git a/frontend/src/pages/signupPage.tsx b/frontend/src/pages/signupPage.tsx index cef3968..537579a 100644 --- a/frontend/src/pages/signupPage.tsx +++ b/frontend/src/pages/signupPage.tsx @@ -33,13 +33,11 @@ export default function SignUp() { } catch (error) { if (error instanceof AxiosError) { let errorMessage = error.response?.data.detail; - console.log(errorMessage) setErrorMessage(JSON.stringify(errorMessage)) } else { setErrorMessage("Unknown Error Occured") } } - //console.log(username, email, password); }; return (