From 3ffc01a30c445c32041187dc31fc6e99fb8f70e1 Mon Sep 17 00:00:00 2001 From: Utkarsh Sanjivan Date: Wed, 15 May 2024 20:11:44 +0530 Subject: [PATCH 1/5] integrated deployed API --- src/components/PDFAssetPage.js | 38 +++++++++++++++------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/components/PDFAssetPage.js b/src/components/PDFAssetPage.js index 453d962..8b6a83a 100644 --- a/src/components/PDFAssetPage.js +++ b/src/components/PDFAssetPage.js @@ -1,5 +1,5 @@ import React, { useState } from "react"; -// import axios from "axios"; +import axios from "axios"; import { Container, FormGroup, @@ -47,7 +47,7 @@ const LoadingSpinner = () => { }; const PDFAssetPage = () => { - // const [selectedFile, setSelectedFile] = useState(null); + const [selectedFile, setSelectedFile] = useState(null); const [summarizedText, setSummarizedText] = useState(""); const [fileName, setFileName] = useState(""); const [fileKey, setFileKey] = useState(0); @@ -58,7 +58,7 @@ const PDFAssetPage = () => { }; const handleFileChange = (event) => { - // setSelectedFile(event.target.files[0]); + setSelectedFile(event.target.files[0]); const file = event.target.files[0]; if (file) { const fileName = file.name.replace(/\s+/g, "-"); @@ -87,24 +87,20 @@ const PDFAssetPage = () => { e.preventDefault(); try { setLoading(true); - setTimeout(() => { - const formattedText = - 'The "Beginner Pilates Workout Plan" is a comprehensive guide designed for individuals new to Pilates exercises.'; - setSummarizedText(formattedText); - setLoading(false); - }, 3000); - // const formData = new FormData(); - // formData.append("file", selectedFile); - // const response = await axios.post( - // "http://127.0.0.1:5000/summarize", - // formData, - // { - // headers: { - // "Content-Type": "multipart/form-data", - // }, - // } - // ); - // const formattedText = response.data.replace(/\. /g, ".\n\n").replace(/\s+/g, " "); + const formData = new FormData(); + formData.append("file", selectedFile); + const response = await axios.post( + "http://16.170.236.3:8080/summarize", + formData, + { + headers: { + "Content-Type": "multipart/form-data", + }, + } + ); + const formattedText = response.data.replace(/\. /g, ".\n\n").replace(/\s+/g, " "); + setSummarizedText(formattedText); + setLoading(false); } catch (error) { console.error("Error summarizing text:", error); setLoading(false); From 736b08802a089c47b0a648d74709b003345ffcdd Mon Sep 17 00:00:00 2001 From: Utkarsh Sanjivan Date: Wed, 15 May 2024 20:15:39 +0530 Subject: [PATCH 2/5] integrated deployed API --- src/components/PDFAssetPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PDFAssetPage.js b/src/components/PDFAssetPage.js index 8b6a83a..4477d04 100644 --- a/src/components/PDFAssetPage.js +++ b/src/components/PDFAssetPage.js @@ -90,7 +90,7 @@ const PDFAssetPage = () => { const formData = new FormData(); formData.append("file", selectedFile); const response = await axios.post( - "http://16.170.236.3:8080/summarize", + "https://16.170.236.3:8080/summarize", formData, { headers: { From a5ef6a3a466da5393d892ecbf35bdaf0146f063d Mon Sep 17 00:00:00 2001 From: Utkarsh Sanjivan Date: Wed, 15 May 2024 22:21:48 +0530 Subject: [PATCH 3/5] integrated deployed API --- src/components/PDFAssetPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PDFAssetPage.js b/src/components/PDFAssetPage.js index 4477d04..8b6a83a 100644 --- a/src/components/PDFAssetPage.js +++ b/src/components/PDFAssetPage.js @@ -90,7 +90,7 @@ const PDFAssetPage = () => { const formData = new FormData(); formData.append("file", selectedFile); const response = await axios.post( - "https://16.170.236.3:8080/summarize", + "http://16.170.236.3:8080/summarize", formData, { headers: { From 9f0432765885533a5a4db4638cd9371276c82a49 Mon Sep 17 00:00:00 2001 From: Utkarsh Sanjivan Date: Wed, 15 May 2024 22:28:07 +0530 Subject: [PATCH 4/5] integrated deployed API --- src/components/PDFAssetPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PDFAssetPage.js b/src/components/PDFAssetPage.js index 8b6a83a..4477d04 100644 --- a/src/components/PDFAssetPage.js +++ b/src/components/PDFAssetPage.js @@ -90,7 +90,7 @@ const PDFAssetPage = () => { const formData = new FormData(); formData.append("file", selectedFile); const response = await axios.post( - "http://16.170.236.3:8080/summarize", + "https://16.170.236.3:8080/summarize", formData, { headers: { From 0795693f111073e1e6cb502d377549646887f7c3 Mon Sep 17 00:00:00 2001 From: Utkarsh Sanjivan Date: Wed, 15 May 2024 22:39:37 +0530 Subject: [PATCH 5/5] integrated deployed API --- src/components/Header.js | 2 ++ src/components/PDFAssetPage.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Header.js b/src/components/Header.js index 476f320..230f692 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -19,7 +19,9 @@ const Header = () => { return (
+ brand-nameSELF +
{true && (
diff --git a/src/components/PDFAssetPage.js b/src/components/PDFAssetPage.js index 4477d04..9e4362c 100644 --- a/src/components/PDFAssetPage.js +++ b/src/components/PDFAssetPage.js @@ -131,7 +131,7 @@ const PDFAssetPage = () => { id="summary" placeholder="PDF Summary here..." style={{ - width: "800px", + width: "70%", height: "150px", fontSize: "18px", fontFamily: "serif",