-
To run the programme go to Server Folder First and type
cd Server
-
Then Install all dependencies by typing
pip install -r requirements.txt
-
Then Run the flask server by
python app.py
-
Then return to the root directory
cd ..
-
Then go to the Client folder
cd Client
-
Then install all the dependencies by typing
npm i
-
Then start the Vite Server by
npm run dev
-
Then Check the website at your https://localhost:5173
-
To Check the API go to https://localhost:3000
- This is the Frontend and a supporting dummy backend for a project of RFQ Splitter
- To Update the backend just modify the GPTmodel.py file inside the server folder
- choose a file to upload
- upload the file using the
upload
button - then generate response using the
generate
button - then download the generated responses seperately using
download
button under each generated section - clear everything using the
clear
button
I am not making the model but if it is made it can be used in the GPTmodel.py file by modifying it
The API is built on FLASK and has 4 endpoints
-
/upload
@app.route("/upload", methods=['POST']) def upload_file(): if request.method == 'POST': file = request.files['file'] if file.filename != '': # Save the file to a temporary location upload_folder = 'path' os.makedirs(upload_folder, exist_ok=True) file_path = os.path.join(upload_folder, file.filename) file.save(file_path) path[0]=file_path initialize() return "File uploaded successfully" else: return 'No file uploaded'
- This end point basically supports the upload feature in the frontend by storing the file uploaded in a path folder which if doesn't exist it creates automatically
- To add any functionality while uploading the file for easier generation add that to the
initialize()
function in the GPTmodel.py
-
/response
@app.route("/response", methods=['GET']) def get_response(): return giveResults(path[0])
- This generates the Response that needs to be shown in the frontend as well as creates .txt files which can be downloaded by calling the download endpoint
- To modify anything in this response, modify the
getResults()
function in the GPTmodel.py
-
/download/<filetype>
@app.route("/download/<filetype>", methods=['GET']) def download_file(filetype): if os.path.exists("path\\"+filetype+"_results.txt"): return send_file("path\\"+filetype+"_results.txt", mimetype='*/*', as_attachment=True) else: return 'No Such File Exists'
This Returns the generated files for download
-
/cleardata
@app.route("/cleardata", methods=['GET']) def clear_data(): shutil.rmtree('path') return "Data Cleared"
This endpoint deletes the
path
folder after all operations has been performed