|
|
@ -98,16 +98,12 @@ |
|
|
|
|
|
|
|
// export default Search;
|
|
|
|
|
|
|
|
|
|
|
|
import React, { useRef, useEffect, useState } from "react"; |
|
|
|
import React, { useRef, useEffect } from "react"; |
|
|
|
import "./Search.css"; // Import CSS for styling
|
|
|
|
|
|
|
|
const Search: React.FC = () => { |
|
|
|
const videoRef = useRef<HTMLVideoElement>(null); |
|
|
|
const canvasRef = useRef<HTMLCanvasElement>(null); |
|
|
|
const [uploadedFile, setUploadedFile] = useState<File | null>(null); |
|
|
|
|
|
|
|
// Automatically opennig the camera when the component mounts
|
|
|
|
useEffect(() => { |
|
|
|
const openCamera = async () => { |
|
|
|
try { |
|
|
@ -149,7 +145,6 @@ const Search: React.FC = () => { |
|
|
|
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => { |
|
|
|
const file = event.target.files?.[0]; |
|
|
|
if (file) { |
|
|
|
setUploadedFile(file); // Storing the uploaded file in state
|
|
|
|
callApi(file); // Calling the API with the uploaded file
|
|
|
|
} |
|
|
|
}; |
|
|
@ -219,5 +214,4 @@ const Search: React.FC = () => { |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export default Search; |