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 453d962..9e4362c 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( + "https://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); @@ -135,7 +131,7 @@ const PDFAssetPage = () => { id="summary" placeholder="PDF Summary here..." style={{ - width: "800px", + width: "70%", height: "150px", fontSize: "18px", fontFamily: "serif",