- Node.js (version 14 or higher)
- npm (Node Package Manager)
Clone the repository to your local machine using the following command:
git clone https://github.com/Mohammedbbk/Ejar.gitNavigate to the project directory and install the required packages:
cd Ejar
npm installStart the application on your local machine:
npm startThe application will open at http://localhost:3000.
-
In the file
EjarLanding.js, locate thehandleAnalyzefunction. -
This function is where you should integrate the AI model.
-
Currently, it simulates analysis with the following line:
setAnalysisResult(`Analysis complete for ${file.name}`);
-
Replace the simulated analysis in
handleAnalyzewith an actual API call. -
Example using
fetch:const handleAnalyze = () => { if (file) { const formData = new FormData(); formData.append('file', file); fetch('http://localhost:5000/analyze', { method: 'POST', body: formData, }) .then((response) => response.json()) .then((data) => { setAnalysisResult(data.result); }) .catch((error) => { console.error('Error:', error); }); } };
-
Ensure the API returns a JSON response containing the analysis result.
- Run your AI model's API server on a specific port (e.g., 5000).
- Configure CORS if necessary to allow the frontend to access the API.
- Only PDF and Word document types are accepted.