diff --git a/.gitignore b/.gitignore index 44e490e12b8f099056c2ad1511aa1761dac2aec0..4d29575de80483b005c29bfcac5061cd2f45313e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,3 @@ npm-debug.log* yarn-debug.log* yarn-error.log* - -.history \ No newline at end of file diff --git a/.history/src/Audio_20240202134633.js b/.history/src/Audio_20240202134633.js deleted file mode 100644 index 7d5b7d0ba3f7e941cd9799a125ffcf2d5c25e422..0000000000000000000000000000000000000000 --- a/.history/src/Audio_20240202134633.js +++ /dev/null @@ -1,208 +0,0 @@ -import React, { useEffect, useState } from "react"; -import "./Styles.css"; -import Video from "./Video"; -import Loading from "./Loading"; - -function Audio({ audioResponse, requestId }) { - const [videoResponse, setVideoResponse] = useState(""); - const [audioUrl, setAudioUrl] = useState(""); - const [loading, setLoading] = useState(""); - const [timer, setTimer] = useState(0); // Timer in seconds - - // console.log(requestId); - - const handleGetVideo = async () => { - if (audioResponse) { - setLoading(true); - setTimer(0); // Reset the timer - let audio = audioResponse; - let request_id = requestId; - // console.log(request_id); - try { - const response = await fetch("http://34.160.236.91:8000/get_video", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ audio, request_id }), // Send the summary as the request - }); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.video); - setVideoResponse(data.video); - // console.log(videoResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - if (audioResponse) { - try { - const audioDataUri = `data:audio/wav;base64,${audioResponse}`; - setAudioUrl(audioDataUri); - } catch (error) { - console.error("Error converting audio data to data URI:", error); - } - } - }, [audioResponse]); - - useEffect(() => { - console.log("Updated videoResponse:", videoResponse); - }, [videoResponse]); - - // const audioBlob = new Blob([audioResponse], { type: "audio/wav" }); - // const audioUrl = URL.createObjectURL(audioBlob); - - // console.log("Video: ", videoResponse); - // let x = audioUrl; - // console.log(audioUrl); - - useEffect(() => { - // Start the timer when loading is true - let interval; - if (loading) { - interval = setInterval(() => { - setTimer((prevTimer) => prevTimer + 1); - }, 1000); // Update the timer every 1 second - } else { - clearInterval(interval); // Clear the interval when loading is false - } - - return () => { - clearInterval(interval); // Cleanup the interval on unmount - }; - }, [loading]); - - function formatTime(seconds) { - const minutes = Math.floor(seconds / 60); - const remainingSeconds = seconds % 60; - const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes; - const formattedSeconds = - remainingSeconds < 10 ? `0${remainingSeconds}` : remainingSeconds; - return `${formattedMinutes}:${formattedSeconds}`; - } - - // let videoResponse1 = - // "https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4"; - - const downloadVideo = () => { - if (videoResponse) { - // Downloads the file - const link = document.createElement("a"); - link.download = "News.mp4"; - const blob = new Blob([videoResponse], { type: "video/mp4" }); - console.log(blob); - link.href = URL.createObjectURL(blob); - link.click(); - URL.revokeObjectURL(link.href); - } - }; - - const handleTryNew = () => { - window.scrollTo({ - top: 0, - behavior: "smooth", // Use smooth scrolling behavior - }); - - // Reload the page after a short delay (e.g., 500 milliseconds) - setTimeout(() => { - window.location.reload(); - }, 600); - }; - - return ( - <div className="container"> - <div className="audio-container"> - <h2 className="sub-heading">Audio</h2> - - {audioUrl ? ( - <div> - <audio controls name="media"> - <source src={audioUrl} type="audio/wav" /> - </audio> - </div> - ) : ( - <div> - <audio controls name="media"> - {/* <source type="audio/wav" /> */} - </audio> - </div> - )} - {loading ? ( - <> - <button className="video-load-btn">Generating...</button> - <p className="get-video-msg"> - Please hold on!! Video generation will take around 2 to 3 minutes. - Timer: {formatTime(timer)} - </p> - {/* <p className="timer">Timer: {formatTime(timer)}</p> */} - </> - ) : ( - <button className="button" onClick={handleGetVideo}> - Get Video - </button> - )} - </div> - - {/* <Video videoResponse={videoResponse} requestId={requestId} /> */} - {/* Display the video response */} - <div className="video-container"> - <h2 className="sub-heading">Video</h2> - {/* <div className="video-container">{videoResponse}</div>{" "} */} - {loading ? ( - <div className="loading-container"> - <Loading /> - </div> - ) : ( - <> - <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - <button className="button" onClick={handleTryNew}> - Retry - </button> - </div> - </> - )} - {/* <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - </div> */} - {/* https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4 */} - {/* Display the video response */} - </div> - </div> - ); -} - -export default Audio; diff --git a/.history/src/Audio_20240205114722.js b/.history/src/Audio_20240205114722.js deleted file mode 100644 index e19aa758430509faab5cd4dc4a3bcc3edce44e0c..0000000000000000000000000000000000000000 --- a/.history/src/Audio_20240205114722.js +++ /dev/null @@ -1,208 +0,0 @@ -import React, { useEffect, useState } from "react"; -import "./Styles.css"; -import Video from "./Video"; -import Loading from "./Loading"; - -function Audio({ audioResponse, requestId }) { - const [videoResponse, setVideoResponse] = useState(""); - const [audioUrl, setAudioUrl] = useState(""); - const [loading, setLoading] = useState(""); - const [timer, setTimer] = useState(0); // Timer in seconds - - // console.log(requestId); - - const handleGetVideo = async () => { - if (audioResponse) { - setLoading(true); - setTimer(0); // Reset the timer - let audio = audioResponse; - let request_id = requestId; - // console.log(request_id); - try { - const response = await fetch("http://34.160.236.91 /get_video", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ audio, request_id }), // Send the summary as the request - }); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.video); - setVideoResponse(data.video); - // console.log(videoResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - if (audioResponse) { - try { - const audioDataUri = `data:audio/wav;base64,${audioResponse}`; - setAudioUrl(audioDataUri); - } catch (error) { - console.error("Error converting audio data to data URI:", error); - } - } - }, [audioResponse]); - - useEffect(() => { - console.log("Updated videoResponse:", videoResponse); - }, [videoResponse]); - - // const audioBlob = new Blob([audioResponse], { type: "audio/wav" }); - // const audioUrl = URL.createObjectURL(audioBlob); - - // console.log("Video: ", videoResponse); - // let x = audioUrl; - // console.log(audioUrl); - - useEffect(() => { - // Start the timer when loading is true - let interval; - if (loading) { - interval = setInterval(() => { - setTimer((prevTimer) => prevTimer + 1); - }, 1000); // Update the timer every 1 second - } else { - clearInterval(interval); // Clear the interval when loading is false - } - - return () => { - clearInterval(interval); // Cleanup the interval on unmount - }; - }, [loading]); - - function formatTime(seconds) { - const minutes = Math.floor(seconds / 60); - const remainingSeconds = seconds % 60; - const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes; - const formattedSeconds = - remainingSeconds < 10 ? `0${remainingSeconds}` : remainingSeconds; - return `${formattedMinutes}:${formattedSeconds}`; - } - - // let videoResponse1 = - // "https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4"; - - const downloadVideo = () => { - if (videoResponse) { - // Downloads the file - const link = document.createElement("a"); - link.download = "News.mp4"; - const blob = new Blob([videoResponse], { type: "video/mp4" }); - console.log(blob); - link.href = URL.createObjectURL(blob); - link.click(); - URL.revokeObjectURL(link.href); - } - }; - - const handleTryNew = () => { - window.scrollTo({ - top: 0, - behavior: "smooth", // Use smooth scrolling behavior - }); - - // Reload the page after a short delay (e.g., 500 milliseconds) - setTimeout(() => { - window.location.reload(); - }, 600); - }; - - return ( - <div className="container"> - <div className="audio-container"> - <h2 className="sub-heading">Audio</h2> - - {audioUrl ? ( - <div> - <audio controls name="media"> - <source src={audioUrl} type="audio/wav" /> - </audio> - </div> - ) : ( - <div> - <audio controls name="media"> - {/* <source type="audio/wav" /> */} - </audio> - </div> - )} - {loading ? ( - <> - <button className="video-load-btn">Generating...</button> - <p className="get-video-msg"> - Please hold on!! Video generation will take around 2 to 3 minutes. - Timer: {formatTime(timer)} - </p> - {/* <p className="timer">Timer: {formatTime(timer)}</p> */} - </> - ) : ( - <button className="button" onClick={handleGetVideo}> - Get Video - </button> - )} - </div> - - {/* <Video videoResponse={videoResponse} requestId={requestId} /> */} - {/* Display the video response */} - <div className="video-container"> - <h2 className="sub-heading">Video</h2> - {/* <div className="video-container">{videoResponse}</div>{" "} */} - {loading ? ( - <div className="loading-container"> - <Loading /> - </div> - ) : ( - <> - <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - <button className="button" onClick={handleTryNew}> - Retry - </button> - </div> - </> - )} - {/* <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - </div> */} - {/* https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4 */} - {/* Display the video response */} - </div> - </div> - ); -} - -export default Audio; diff --git a/.history/src/Audio_20240205114724.js b/.history/src/Audio_20240205114724.js deleted file mode 100644 index 3ef180b6fb5f47c8f40b8bc999016ee0091a6d79..0000000000000000000000000000000000000000 --- a/.history/src/Audio_20240205114724.js +++ /dev/null @@ -1,208 +0,0 @@ -import React, { useEffect, useState } from "react"; -import "./Styles.css"; -import Video from "./Video"; -import Loading from "./Loading"; - -function Audio({ audioResponse, requestId }) { - const [videoResponse, setVideoResponse] = useState(""); - const [audioUrl, setAudioUrl] = useState(""); - const [loading, setLoading] = useState(""); - const [timer, setTimer] = useState(0); // Timer in seconds - - // console.log(requestId); - - const handleGetVideo = async () => { - if (audioResponse) { - setLoading(true); - setTimer(0); // Reset the timer - let audio = audioResponse; - let request_id = requestId; - // console.log(request_id); - try { - const response = await fetch("http://34.160.236.91/get_video", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ audio, request_id }), // Send the summary as the request - }); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.video); - setVideoResponse(data.video); - // console.log(videoResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - if (audioResponse) { - try { - const audioDataUri = `data:audio/wav;base64,${audioResponse}`; - setAudioUrl(audioDataUri); - } catch (error) { - console.error("Error converting audio data to data URI:", error); - } - } - }, [audioResponse]); - - useEffect(() => { - console.log("Updated videoResponse:", videoResponse); - }, [videoResponse]); - - // const audioBlob = new Blob([audioResponse], { type: "audio/wav" }); - // const audioUrl = URL.createObjectURL(audioBlob); - - // console.log("Video: ", videoResponse); - // let x = audioUrl; - // console.log(audioUrl); - - useEffect(() => { - // Start the timer when loading is true - let interval; - if (loading) { - interval = setInterval(() => { - setTimer((prevTimer) => prevTimer + 1); - }, 1000); // Update the timer every 1 second - } else { - clearInterval(interval); // Clear the interval when loading is false - } - - return () => { - clearInterval(interval); // Cleanup the interval on unmount - }; - }, [loading]); - - function formatTime(seconds) { - const minutes = Math.floor(seconds / 60); - const remainingSeconds = seconds % 60; - const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes; - const formattedSeconds = - remainingSeconds < 10 ? `0${remainingSeconds}` : remainingSeconds; - return `${formattedMinutes}:${formattedSeconds}`; - } - - // let videoResponse1 = - // "https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4"; - - const downloadVideo = () => { - if (videoResponse) { - // Downloads the file - const link = document.createElement("a"); - link.download = "News.mp4"; - const blob = new Blob([videoResponse], { type: "video/mp4" }); - console.log(blob); - link.href = URL.createObjectURL(blob); - link.click(); - URL.revokeObjectURL(link.href); - } - }; - - const handleTryNew = () => { - window.scrollTo({ - top: 0, - behavior: "smooth", // Use smooth scrolling behavior - }); - - // Reload the page after a short delay (e.g., 500 milliseconds) - setTimeout(() => { - window.location.reload(); - }, 600); - }; - - return ( - <div className="container"> - <div className="audio-container"> - <h2 className="sub-heading">Audio</h2> - - {audioUrl ? ( - <div> - <audio controls name="media"> - <source src={audioUrl} type="audio/wav" /> - </audio> - </div> - ) : ( - <div> - <audio controls name="media"> - {/* <source type="audio/wav" /> */} - </audio> - </div> - )} - {loading ? ( - <> - <button className="video-load-btn">Generating...</button> - <p className="get-video-msg"> - Please hold on!! Video generation will take around 2 to 3 minutes. - Timer: {formatTime(timer)} - </p> - {/* <p className="timer">Timer: {formatTime(timer)}</p> */} - </> - ) : ( - <button className="button" onClick={handleGetVideo}> - Get Video - </button> - )} - </div> - - {/* <Video videoResponse={videoResponse} requestId={requestId} /> */} - {/* Display the video response */} - <div className="video-container"> - <h2 className="sub-heading">Video</h2> - {/* <div className="video-container">{videoResponse}</div>{" "} */} - {loading ? ( - <div className="loading-container"> - <Loading /> - </div> - ) : ( - <> - <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - <button className="button" onClick={handleTryNew}> - Retry - </button> - </div> - </> - )} - {/* <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - </div> */} - {/* https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4 */} - {/* Display the video response */} - </div> - </div> - ); -} - -export default Audio; diff --git a/.history/src/Audio_20240205175545.js b/.history/src/Audio_20240205175545.js deleted file mode 100644 index 95767543c66d5d0b272f1659a2cf30cb9cc8faf8..0000000000000000000000000000000000000000 --- a/.history/src/Audio_20240205175545.js +++ /dev/null @@ -1,208 +0,0 @@ -import React, { useEffect, useState } from "react"; -import "./Styles.css"; -import Video from "./Video"; -import Loading from "./Loading"; - -function Audio({ audioResponse, requestId }) { - const [videoResponse, setVideoResponse] = useState(""); - const [audioUrl, setAudioUrl] = useState(""); - const [loading, setLoading] = useState(""); - const [timer, setTimer] = useState(0); // Timer in seconds - - // console.log(requestId); - - const handleGetVideo = async () => { - if (audioResponse) { - setLoading(true); - setTimer(0); // Reset the timer - let audio = audioResponse; - let request_id = requestId; - // console.log(request_id); - try { - const response = await fetch("https://34.160.236.91/get_video", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ audio, request_id }), // Send the summary as the request - }); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.video); - setVideoResponse(data.video); - // console.log(videoResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - if (audioResponse) { - try { - const audioDataUri = `data:audio/wav;base64,${audioResponse}`; - setAudioUrl(audioDataUri); - } catch (error) { - console.error("Error converting audio data to data URI:", error); - } - } - }, [audioResponse]); - - useEffect(() => { - console.log("Updated videoResponse:", videoResponse); - }, [videoResponse]); - - // const audioBlob = new Blob([audioResponse], { type: "audio/wav" }); - // const audioUrl = URL.createObjectURL(audioBlob); - - // console.log("Video: ", videoResponse); - // let x = audioUrl; - // console.log(audioUrl); - - useEffect(() => { - // Start the timer when loading is true - let interval; - if (loading) { - interval = setInterval(() => { - setTimer((prevTimer) => prevTimer + 1); - }, 1000); // Update the timer every 1 second - } else { - clearInterval(interval); // Clear the interval when loading is false - } - - return () => { - clearInterval(interval); // Cleanup the interval on unmount - }; - }, [loading]); - - function formatTime(seconds) { - const minutes = Math.floor(seconds / 60); - const remainingSeconds = seconds % 60; - const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes; - const formattedSeconds = - remainingSeconds < 10 ? `0${remainingSeconds}` : remainingSeconds; - return `${formattedMinutes}:${formattedSeconds}`; - } - - // let videoResponse1 = - // "https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4"; - - const downloadVideo = () => { - if (videoResponse) { - // Downloads the file - const link = document.createElement("a"); - link.download = "News.mp4"; - const blob = new Blob([videoResponse], { type: "video/mp4" }); - console.log(blob); - link.href = URL.createObjectURL(blob); - link.click(); - URL.revokeObjectURL(link.href); - } - }; - - const handleTryNew = () => { - window.scrollTo({ - top: 0, - behavior: "smooth", // Use smooth scrolling behavior - }); - - // Reload the page after a short delay (e.g., 500 milliseconds) - setTimeout(() => { - window.location.reload(); - }, 600); - }; - - return ( - <div className="container"> - <div className="audio-container"> - <h2 className="sub-heading">Audio</h2> - - {audioUrl ? ( - <div> - <audio controls name="media"> - <source src={audioUrl} type="audio/wav" /> - </audio> - </div> - ) : ( - <div> - <audio controls name="media"> - {/* <source type="audio/wav" /> */} - </audio> - </div> - )} - {loading ? ( - <> - <button className="video-load-btn">Generating...</button> - <p className="get-video-msg"> - Please hold on!! Video generation will take around 2 to 3 minutes. - Timer: {formatTime(timer)} - </p> - {/* <p className="timer">Timer: {formatTime(timer)}</p> */} - </> - ) : ( - <button className="button" onClick={handleGetVideo}> - Get Video - </button> - )} - </div> - - {/* <Video videoResponse={videoResponse} requestId={requestId} /> */} - {/* Display the video response */} - <div className="video-container"> - <h2 className="sub-heading">Video</h2> - {/* <div className="video-container">{videoResponse}</div>{" "} */} - {loading ? ( - <div className="loading-container"> - <Loading /> - </div> - ) : ( - <> - <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - <button className="button" onClick={handleTryNew}> - Retry - </button> - </div> - </> - )} - {/* <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - </div> */} - {/* https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4 */} - {/* Display the video response */} - </div> - </div> - ); -} - -export default Audio; diff --git a/.history/src/Audio_20240206122800.js b/.history/src/Audio_20240206122800.js deleted file mode 100644 index 1e15fa5aaa5211c2f052cb82db3a4907ba8387f1..0000000000000000000000000000000000000000 --- a/.history/src/Audio_20240206122800.js +++ /dev/null @@ -1,211 +0,0 @@ -import React, { useEffect, useState } from "react"; -import "./Styles.css"; -import Video from "./Video"; -import Loading from "./Loading"; - -function Audio({ audioResponse, requestId }) { - const [videoResponse, setVideoResponse] = useState(""); - const [audioUrl, setAudioUrl] = useState(""); - const [loading, setLoading] = useState(""); - const [timer, setTimer] = useState(0); // Timer in seconds - - // console.log(requestId); - - const handleGetVideo = async () => { - if (audioResponse) { - setLoading(true); - setTimer(0); // Reset the timer - let audio = audioResponse; - let request_id = requestId; - // console.log(request_id); - try { - const response = await fetch( - "https://texttovideo.ns-devsecops.com/get_video", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ audio, request_id }), // Send the summary as the request - } - ); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.video); - setVideoResponse(data.video); - // console.log(videoResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - if (audioResponse) { - try { - const audioDataUri = `data:audio/wav;base64,${audioResponse}`; - setAudioUrl(audioDataUri); - } catch (error) { - console.error("Error converting audio data to data URI:", error); - } - } - }, [audioResponse]); - - useEffect(() => { - console.log("Updated videoResponse:", videoResponse); - }, [videoResponse]); - - // const audioBlob = new Blob([audioResponse], { type: "audio/wav" }); - // const audioUrl = URL.createObjectURL(audioBlob); - - // console.log("Video: ", videoResponse); - // let x = audioUrl; - // console.log(audioUrl); - - useEffect(() => { - // Start the timer when loading is true - let interval; - if (loading) { - interval = setInterval(() => { - setTimer((prevTimer) => prevTimer + 1); - }, 1000); // Update the timer every 1 second - } else { - clearInterval(interval); // Clear the interval when loading is false - } - - return () => { - clearInterval(interval); // Cleanup the interval on unmount - }; - }, [loading]); - - function formatTime(seconds) { - const minutes = Math.floor(seconds / 60); - const remainingSeconds = seconds % 60; - const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes; - const formattedSeconds = - remainingSeconds < 10 ? `0${remainingSeconds}` : remainingSeconds; - return `${formattedMinutes}:${formattedSeconds}`; - } - - // let videoResponse1 = - // "https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4"; - - const downloadVideo = () => { - if (videoResponse) { - // Downloads the file - const link = document.createElement("a"); - link.download = "News.mp4"; - const blob = new Blob([videoResponse], { type: "video/mp4" }); - console.log(blob); - link.href = URL.createObjectURL(blob); - link.click(); - URL.revokeObjectURL(link.href); - } - }; - - const handleTryNew = () => { - window.scrollTo({ - top: 0, - behavior: "smooth", // Use smooth scrolling behavior - }); - - // Reload the page after a short delay (e.g., 500 milliseconds) - setTimeout(() => { - window.location.reload(); - }, 600); - }; - - return ( - <div className="container"> - <div className="audio-container"> - <h2 className="sub-heading">Audio</h2> - - {audioUrl ? ( - <div> - <audio controls name="media"> - <source src={audioUrl} type="audio/wav" /> - </audio> - </div> - ) : ( - <div> - <audio controls name="media"> - {/* <source type="audio/wav" /> */} - </audio> - </div> - )} - {loading ? ( - <> - <button className="video-load-btn">Generating...</button> - <p className="get-video-msg"> - Please hold on!! Video generation will take around 2 to 3 minutes. - Timer: {formatTime(timer)} - </p> - {/* <p className="timer">Timer: {formatTime(timer)}</p> */} - </> - ) : ( - <button className="button" onClick={handleGetVideo}> - Get Video - </button> - )} - </div> - - {/* <Video videoResponse={videoResponse} requestId={requestId} /> */} - {/* Display the video response */} - <div className="video-container"> - <h2 className="sub-heading">Video</h2> - {/* <div className="video-container">{videoResponse}</div>{" "} */} - {loading ? ( - <div className="loading-container"> - <Loading /> - </div> - ) : ( - <> - <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - <button className="button" onClick={handleTryNew}> - Retry - </button> - </div> - </> - )} - {/* <div> - <video - // width="320" - height="425" - controls - key={videoResponse} - > - <source src={videoResponse} type="video/mp4" /> - </video> - </div> - <div> - <button className="button" onClick={downloadVideo}> - Download - </button> - </div> */} - {/* https://storage.googleapis.com/wav2lip-niveus/output/123/result.mp4 */} - {/* Display the video response */} - </div> - </div> - ); -} - -export default Audio; diff --git a/.history/src/News_20240202134619.js b/.history/src/News_20240202134619.js deleted file mode 100644 index ffb2cdfe4a938694e78ca98ba75f24d637899b07..0000000000000000000000000000000000000000 --- a/.history/src/News_20240202134619.js +++ /dev/null @@ -1,164 +0,0 @@ -import { useState } from "react"; -import Summary from "./Summary"; - -function News() { - const [text, setText] = useState(""); - const [summary, setSummary] = useState(""); - const [loading, setLoading] = useState(false); - const [request_id, setRequestId] = useState(null); - - // let random_num = Math.floor(Math.random() * 1000); - // let request_id = random_num; - // let request_id = 123; - - function processNewsText(rawText) { - // Replace " with ' - let news = rawText.replace(/"/g, "'"); - - // Replace \n with space - news = news.replace(/\n/g, " "); - - // Replace \t with space - news = news.replace(/\t/g, " "); - - // Replace \r with space - news = news.replace(/\r/g, " "); - - // Replace ; with space - news = news.replace(/;/g, " "); - - // Replace # with space - news = news.replace(/#/g, " "); - - // Replace -- with space - news = news.replace(/--/g, " "); - - // Replace - with space - news = news.replace(/-/g, " "); - - // Replace () with space - news = news.replace(/\(/g, " "); - news = news.replace(/\)/g, " "); - - return news; - } - - const handleGetSummary = async () => { - if (text) { - setLoading(true); - // let request_id = 123; - let request_id = Math.floor(Math.random() * 1000); - setRequestId(request_id); - // console.log("Text>>>> ", text); - processNewsText = await processNewsText(text); - // console.log(processNewsText); - // console.log(request_id); - - // Set a flag to track if a response has been received - let responseReceived = false; - - // Set a timeout of 40 seconds (40,000 milliseconds) - const timeout = 90000; - - const timeoutId = setTimeout(() => { - if (!responseReceived) { - // Alert the user if no response has been received within the timeout - alert( - "Server is Busy processing another request. We have put you on queue!" - ); - setLoading(false); // Reset loading state - } - }, timeout); - - try { - const response = await fetch("http://34.160.236.91:8000/summarize", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text: processNewsText, request_id }), - }); - if (response.ok) { - clearTimeout(timeoutId); // Clear the timeout if response is received - const data = await response.json(); - // console.log(data); - setSummary(data.summary); - responseReceived = true; - } else { - console.error("Failed to fetch summary"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } else { - alert("Please enter news!!"); - } - }; - - // request_id = request_id; - // console.log(request_id); - - const fillWithSampleData = () => { - const sampleText = `New Delhi (India), August 29: Niveus Solutions, a cloud engineering organization, announced today that it has received the 2023 Google Cloud Partner of the Year Awards for two categories: Google Cloud Services Partner of the Year - Asia Pacific' and 'Google Cloud Expansion Partner of the Year - Asia Pacific'. This marks the second time that Niveus has been recognized by Google Cloud for their outstanding achievements. - - Niveus Solutions was recognized for its achievements in the Google Cloud ecosystem, helping customers across BFSI, Automotive, Media & Entertainment, Manufacturing, PSUs, and Digital Natives industries. Nievus is also recognized for its deep cloud transformation experience within the Asia Pacific region and its comprehensive and compelling digital solutions that are transforming the way industries work. - - "Google Cloud's partner awards recognize the significant impact and customer success that our partners have driven over the past year," said Kevin Ichhpurani, Corporate Vice President of global Ecosystem and Channels at Google Cloud. "We're delighted to recognize Niveus Solutions as a 2023 Google Cloud Partner Award winner, and look forward to a continued strong partnership in support of our mutual customers." - - The Google Cloud Service Partner of the Year - Asia Pacific award recognizes Niveus' commitment to enabling global innovators across diverse industries in their digital transformation. With exceptional technical capabilities and top-tier service offerings, Niveus is committed to delivering outstanding Google Cloud products and solutions as a Service Partner. Niveus' recognition as the Google Cloud Expansion Partner of the Year - Asia Pacific is a testament to its focus on driving growth and expansion throughout the region. Leveraging Google Cloud, Niveus facilitates the seamless adoption and implementation of cloud solutions, empowering businesses to scale rapidly and capitalize on new opportunities. - - "We're proud of the achievements we've made in the previous year and are excited to be named Google Cloud Services Partner of the Year - Asia Pacific and Google Cloud Expansion Partner of the Year - Asia Pacific. We are recognized for our strong partnership with Google Cloud and our best-in-class use of Google Cloud products and services, coupled with our expertise. Winning this prestigious award is a true testament to our agility, innovative leadership, exceptional customer service, and the remarkable growth that we have achieved," said Suyog Shetty, CEO of Niveus Solutions. - - In the previous year, Niveus achieved Infrastructure, Application development, and Data Management Specializations, acquiring 21 new areas of expertise and 167 Professional Google Cloud certifications. They were also recognized as a Google Cloud Regional AlloyDB partner. Notably, their collaboration on an automotive bookings platform resulted in record-breaking sales and improved customer satisfaction. Niveus expanded its team to over 900+ employees across 6+ locations and successfully entered the SEA market. They aim to replicate their success in India with Google in other international markets. Niveus strengthened its presence in the BFSI & DN space and expanded sales capacity to cover other industries like Manufacturing, CPG, and Conglomerates, successfully closing deals with various clients. - - Niveus Solutions Pvt. Ltd. is a cloud-born engineering services organization founded in 2013. Niveus progressed rapidly over the years with the company making a strategic decision in 2019 to exclusively partner with Google Cloud, securing 'Premier Partner status in less than 2 years. Niveus empowers enterprises to harness the power of cloud services and build resilient infrastructures that scale. Niveus specializes in application, infrastructure, & data modernization, data management, cloud consulting, security, & managed services. - `; - setText(sampleText); - }; - - // let request_id = request_id; - - return ( - <div className="container"> - <div className="news-container"> - <h2 className="sub-heading">News</h2> - <div className="sample-container"> - <label className="sample"> - <input - type="checkbox" - name="sampleData" - onClick={fillWithSampleData} - /> - Sample - </label> - </div> - <div className="textarea-container"> - <textarea - // rows="16" - // cols="120" - value={text} - onChange={(e) => setText(e.target.value)} - placeholder="Enter news text here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetSummary}> - Get Summary - </button> - </div> - )} - </div> - - <Summary summary={summary} requestId={request_id} /> - </div> - ); -} - -export default News; diff --git a/.history/src/News_20240205114705.js b/.history/src/News_20240205114705.js deleted file mode 100644 index 53c71027778062c23a45011892c992fe68655b62..0000000000000000000000000000000000000000 --- a/.history/src/News_20240205114705.js +++ /dev/null @@ -1,164 +0,0 @@ -import { useState } from "react"; -import Summary from "./Summary"; - -function News() { - const [text, setText] = useState(""); - const [summary, setSummary] = useState(""); - const [loading, setLoading] = useState(false); - const [request_id, setRequestId] = useState(null); - - // let random_num = Math.floor(Math.random() * 1000); - // let request_id = random_num; - // let request_id = 123; - - function processNewsText(rawText) { - // Replace " with ' - let news = rawText.replace(/"/g, "'"); - - // Replace \n with space - news = news.replace(/\n/g, " "); - - // Replace \t with space - news = news.replace(/\t/g, " "); - - // Replace \r with space - news = news.replace(/\r/g, " "); - - // Replace ; with space - news = news.replace(/;/g, " "); - - // Replace # with space - news = news.replace(/#/g, " "); - - // Replace -- with space - news = news.replace(/--/g, " "); - - // Replace - with space - news = news.replace(/-/g, " "); - - // Replace () with space - news = news.replace(/\(/g, " "); - news = news.replace(/\)/g, " "); - - return news; - } - - const handleGetSummary = async () => { - if (text) { - setLoading(true); - // let request_id = 123; - let request_id = Math.floor(Math.random() * 1000); - setRequestId(request_id); - // console.log("Text>>>> ", text); - processNewsText = await processNewsText(text); - // console.log(processNewsText); - // console.log(request_id); - - // Set a flag to track if a response has been received - let responseReceived = false; - - // Set a timeout of 40 seconds (40,000 milliseconds) - const timeout = 90000; - - const timeoutId = setTimeout(() => { - if (!responseReceived) { - // Alert the user if no response has been received within the timeout - alert( - "Server is Busy processing another request. We have put you on queue!" - ); - setLoading(false); // Reset loading state - } - }, timeout); - - try { - const response = await fetch("http://34.160.236.91/summarize", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text: processNewsText, request_id }), - }); - if (response.ok) { - clearTimeout(timeoutId); // Clear the timeout if response is received - const data = await response.json(); - // console.log(data); - setSummary(data.summary); - responseReceived = true; - } else { - console.error("Failed to fetch summary"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } else { - alert("Please enter news!!"); - } - }; - - // request_id = request_id; - // console.log(request_id); - - const fillWithSampleData = () => { - const sampleText = `New Delhi (India), August 29: Niveus Solutions, a cloud engineering organization, announced today that it has received the 2023 Google Cloud Partner of the Year Awards for two categories: Google Cloud Services Partner of the Year - Asia Pacific' and 'Google Cloud Expansion Partner of the Year - Asia Pacific'. This marks the second time that Niveus has been recognized by Google Cloud for their outstanding achievements. - - Niveus Solutions was recognized for its achievements in the Google Cloud ecosystem, helping customers across BFSI, Automotive, Media & Entertainment, Manufacturing, PSUs, and Digital Natives industries. Nievus is also recognized for its deep cloud transformation experience within the Asia Pacific region and its comprehensive and compelling digital solutions that are transforming the way industries work. - - "Google Cloud's partner awards recognize the significant impact and customer success that our partners have driven over the past year," said Kevin Ichhpurani, Corporate Vice President of global Ecosystem and Channels at Google Cloud. "We're delighted to recognize Niveus Solutions as a 2023 Google Cloud Partner Award winner, and look forward to a continued strong partnership in support of our mutual customers." - - The Google Cloud Service Partner of the Year - Asia Pacific award recognizes Niveus' commitment to enabling global innovators across diverse industries in their digital transformation. With exceptional technical capabilities and top-tier service offerings, Niveus is committed to delivering outstanding Google Cloud products and solutions as a Service Partner. Niveus' recognition as the Google Cloud Expansion Partner of the Year - Asia Pacific is a testament to its focus on driving growth and expansion throughout the region. Leveraging Google Cloud, Niveus facilitates the seamless adoption and implementation of cloud solutions, empowering businesses to scale rapidly and capitalize on new opportunities. - - "We're proud of the achievements we've made in the previous year and are excited to be named Google Cloud Services Partner of the Year - Asia Pacific and Google Cloud Expansion Partner of the Year - Asia Pacific. We are recognized for our strong partnership with Google Cloud and our best-in-class use of Google Cloud products and services, coupled with our expertise. Winning this prestigious award is a true testament to our agility, innovative leadership, exceptional customer service, and the remarkable growth that we have achieved," said Suyog Shetty, CEO of Niveus Solutions. - - In the previous year, Niveus achieved Infrastructure, Application development, and Data Management Specializations, acquiring 21 new areas of expertise and 167 Professional Google Cloud certifications. They were also recognized as a Google Cloud Regional AlloyDB partner. Notably, their collaboration on an automotive bookings platform resulted in record-breaking sales and improved customer satisfaction. Niveus expanded its team to over 900+ employees across 6+ locations and successfully entered the SEA market. They aim to replicate their success in India with Google in other international markets. Niveus strengthened its presence in the BFSI & DN space and expanded sales capacity to cover other industries like Manufacturing, CPG, and Conglomerates, successfully closing deals with various clients. - - Niveus Solutions Pvt. Ltd. is a cloud-born engineering services organization founded in 2013. Niveus progressed rapidly over the years with the company making a strategic decision in 2019 to exclusively partner with Google Cloud, securing 'Premier Partner status in less than 2 years. Niveus empowers enterprises to harness the power of cloud services and build resilient infrastructures that scale. Niveus specializes in application, infrastructure, & data modernization, data management, cloud consulting, security, & managed services. - `; - setText(sampleText); - }; - - // let request_id = request_id; - - return ( - <div className="container"> - <div className="news-container"> - <h2 className="sub-heading">News</h2> - <div className="sample-container"> - <label className="sample"> - <input - type="checkbox" - name="sampleData" - onClick={fillWithSampleData} - /> - Sample - </label> - </div> - <div className="textarea-container"> - <textarea - // rows="16" - // cols="120" - value={text} - onChange={(e) => setText(e.target.value)} - placeholder="Enter news text here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetSummary}> - Get Summary - </button> - </div> - )} - </div> - - <Summary summary={summary} requestId={request_id} /> - </div> - ); -} - -export default News; diff --git a/.history/src/News_20240205175536.js b/.history/src/News_20240205175536.js deleted file mode 100644 index f3a3b0b6ecf934907833b0698fbb3e4c487fc12c..0000000000000000000000000000000000000000 --- a/.history/src/News_20240205175536.js +++ /dev/null @@ -1,164 +0,0 @@ -import { useState } from "react"; -import Summary from "./Summary"; - -function News() { - const [text, setText] = useState(""); - const [summary, setSummary] = useState(""); - const [loading, setLoading] = useState(false); - const [request_id, setRequestId] = useState(null); - - // let random_num = Math.floor(Math.random() * 1000); - // let request_id = random_num; - // let request_id = 123; - - function processNewsText(rawText) { - // Replace " with ' - let news = rawText.replace(/"/g, "'"); - - // Replace \n with space - news = news.replace(/\n/g, " "); - - // Replace \t with space - news = news.replace(/\t/g, " "); - - // Replace \r with space - news = news.replace(/\r/g, " "); - - // Replace ; with space - news = news.replace(/;/g, " "); - - // Replace # with space - news = news.replace(/#/g, " "); - - // Replace -- with space - news = news.replace(/--/g, " "); - - // Replace - with space - news = news.replace(/-/g, " "); - - // Replace () with space - news = news.replace(/\(/g, " "); - news = news.replace(/\)/g, " "); - - return news; - } - - const handleGetSummary = async () => { - if (text) { - setLoading(true); - // let request_id = 123; - let request_id = Math.floor(Math.random() * 1000); - setRequestId(request_id); - // console.log("Text>>>> ", text); - processNewsText = await processNewsText(text); - // console.log(processNewsText); - // console.log(request_id); - - // Set a flag to track if a response has been received - let responseReceived = false; - - // Set a timeout of 40 seconds (40,000 milliseconds) - const timeout = 90000; - - const timeoutId = setTimeout(() => { - if (!responseReceived) { - // Alert the user if no response has been received within the timeout - alert( - "Server is Busy processing another request. We have put you on queue!" - ); - setLoading(false); // Reset loading state - } - }, timeout); - - try { - const response = await fetch("https://34.160.236.91/summarize", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text: processNewsText, request_id }), - }); - if (response.ok) { - clearTimeout(timeoutId); // Clear the timeout if response is received - const data = await response.json(); - // console.log(data); - setSummary(data.summary); - responseReceived = true; - } else { - console.error("Failed to fetch summary"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } else { - alert("Please enter news!!"); - } - }; - - // request_id = request_id; - // console.log(request_id); - - const fillWithSampleData = () => { - const sampleText = `New Delhi (India), August 29: Niveus Solutions, a cloud engineering organization, announced today that it has received the 2023 Google Cloud Partner of the Year Awards for two categories: Google Cloud Services Partner of the Year - Asia Pacific' and 'Google Cloud Expansion Partner of the Year - Asia Pacific'. This marks the second time that Niveus has been recognized by Google Cloud for their outstanding achievements. - - Niveus Solutions was recognized for its achievements in the Google Cloud ecosystem, helping customers across BFSI, Automotive, Media & Entertainment, Manufacturing, PSUs, and Digital Natives industries. Nievus is also recognized for its deep cloud transformation experience within the Asia Pacific region and its comprehensive and compelling digital solutions that are transforming the way industries work. - - "Google Cloud's partner awards recognize the significant impact and customer success that our partners have driven over the past year," said Kevin Ichhpurani, Corporate Vice President of global Ecosystem and Channels at Google Cloud. "We're delighted to recognize Niveus Solutions as a 2023 Google Cloud Partner Award winner, and look forward to a continued strong partnership in support of our mutual customers." - - The Google Cloud Service Partner of the Year - Asia Pacific award recognizes Niveus' commitment to enabling global innovators across diverse industries in their digital transformation. With exceptional technical capabilities and top-tier service offerings, Niveus is committed to delivering outstanding Google Cloud products and solutions as a Service Partner. Niveus' recognition as the Google Cloud Expansion Partner of the Year - Asia Pacific is a testament to its focus on driving growth and expansion throughout the region. Leveraging Google Cloud, Niveus facilitates the seamless adoption and implementation of cloud solutions, empowering businesses to scale rapidly and capitalize on new opportunities. - - "We're proud of the achievements we've made in the previous year and are excited to be named Google Cloud Services Partner of the Year - Asia Pacific and Google Cloud Expansion Partner of the Year - Asia Pacific. We are recognized for our strong partnership with Google Cloud and our best-in-class use of Google Cloud products and services, coupled with our expertise. Winning this prestigious award is a true testament to our agility, innovative leadership, exceptional customer service, and the remarkable growth that we have achieved," said Suyog Shetty, CEO of Niveus Solutions. - - In the previous year, Niveus achieved Infrastructure, Application development, and Data Management Specializations, acquiring 21 new areas of expertise and 167 Professional Google Cloud certifications. They were also recognized as a Google Cloud Regional AlloyDB partner. Notably, their collaboration on an automotive bookings platform resulted in record-breaking sales and improved customer satisfaction. Niveus expanded its team to over 900+ employees across 6+ locations and successfully entered the SEA market. They aim to replicate their success in India with Google in other international markets. Niveus strengthened its presence in the BFSI & DN space and expanded sales capacity to cover other industries like Manufacturing, CPG, and Conglomerates, successfully closing deals with various clients. - - Niveus Solutions Pvt. Ltd. is a cloud-born engineering services organization founded in 2013. Niveus progressed rapidly over the years with the company making a strategic decision in 2019 to exclusively partner with Google Cloud, securing 'Premier Partner status in less than 2 years. Niveus empowers enterprises to harness the power of cloud services and build resilient infrastructures that scale. Niveus specializes in application, infrastructure, & data modernization, data management, cloud consulting, security, & managed services. - `; - setText(sampleText); - }; - - // let request_id = request_id; - - return ( - <div className="container"> - <div className="news-container"> - <h2 className="sub-heading">News</h2> - <div className="sample-container"> - <label className="sample"> - <input - type="checkbox" - name="sampleData" - onClick={fillWithSampleData} - /> - Sample - </label> - </div> - <div className="textarea-container"> - <textarea - // rows="16" - // cols="120" - value={text} - onChange={(e) => setText(e.target.value)} - placeholder="Enter news text here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetSummary}> - Get Summary - </button> - </div> - )} - </div> - - <Summary summary={summary} requestId={request_id} /> - </div> - ); -} - -export default News; diff --git a/.history/src/News_20240206122733.js b/.history/src/News_20240206122733.js deleted file mode 100644 index 102b54251250deb107cabb629746d870db160b6b..0000000000000000000000000000000000000000 --- a/.history/src/News_20240206122733.js +++ /dev/null @@ -1,167 +0,0 @@ -import { useState } from "react"; -import Summary from "./Summary"; - -function News() { - const [text, setText] = useState(""); - const [summary, setSummary] = useState(""); - const [loading, setLoading] = useState(false); - const [request_id, setRequestId] = useState(null); - - // let random_num = Math.floor(Math.random() * 1000); - // let request_id = random_num; - // let request_id = 123; - - function processNewsText(rawText) { - // Replace " with ' - let news = rawText.replace(/"/g, "'"); - - // Replace \n with space - news = news.replace(/\n/g, " "); - - // Replace \t with space - news = news.replace(/\t/g, " "); - - // Replace \r with space - news = news.replace(/\r/g, " "); - - // Replace ; with space - news = news.replace(/;/g, " "); - - // Replace # with space - news = news.replace(/#/g, " "); - - // Replace -- with space - news = news.replace(/--/g, " "); - - // Replace - with space - news = news.replace(/-/g, " "); - - // Replace () with space - news = news.replace(/\(/g, " "); - news = news.replace(/\)/g, " "); - - return news; - } - - const handleGetSummary = async () => { - if (text) { - setLoading(true); - // let request_id = 123; - let request_id = Math.floor(Math.random() * 1000); - setRequestId(request_id); - // console.log("Text>>>> ", text); - processNewsText = await processNewsText(text); - // console.log(processNewsText); - // console.log(request_id); - - // Set a flag to track if a response has been received - let responseReceived = false; - - // Set a timeout of 40 seconds (40,000 milliseconds) - const timeout = 90000; - - const timeoutId = setTimeout(() => { - if (!responseReceived) { - // Alert the user if no response has been received within the timeout - alert( - "Server is Busy processing another request. We have put you on queue!" - ); - setLoading(false); // Reset loading state - } - }, timeout); - - try { - const response = await fetch( - "https://texttovideo.ns-devsecops.com/summarize", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text: processNewsText, request_id }), - } - ); - if (response.ok) { - clearTimeout(timeoutId); // Clear the timeout if response is received - const data = await response.json(); - // console.log(data); - setSummary(data.summary); - responseReceived = true; - } else { - console.error("Failed to fetch summary"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } else { - alert("Please enter news!!"); - } - }; - - // request_id = request_id; - // console.log(request_id); - - const fillWithSampleData = () => { - const sampleText = `New Delhi (India), August 29: Niveus Solutions, a cloud engineering organization, announced today that it has received the 2023 Google Cloud Partner of the Year Awards for two categories: Google Cloud Services Partner of the Year - Asia Pacific' and 'Google Cloud Expansion Partner of the Year - Asia Pacific'. This marks the second time that Niveus has been recognized by Google Cloud for their outstanding achievements. - - Niveus Solutions was recognized for its achievements in the Google Cloud ecosystem, helping customers across BFSI, Automotive, Media & Entertainment, Manufacturing, PSUs, and Digital Natives industries. Nievus is also recognized for its deep cloud transformation experience within the Asia Pacific region and its comprehensive and compelling digital solutions that are transforming the way industries work. - - "Google Cloud's partner awards recognize the significant impact and customer success that our partners have driven over the past year," said Kevin Ichhpurani, Corporate Vice President of global Ecosystem and Channels at Google Cloud. "We're delighted to recognize Niveus Solutions as a 2023 Google Cloud Partner Award winner, and look forward to a continued strong partnership in support of our mutual customers." - - The Google Cloud Service Partner of the Year - Asia Pacific award recognizes Niveus' commitment to enabling global innovators across diverse industries in their digital transformation. With exceptional technical capabilities and top-tier service offerings, Niveus is committed to delivering outstanding Google Cloud products and solutions as a Service Partner. Niveus' recognition as the Google Cloud Expansion Partner of the Year - Asia Pacific is a testament to its focus on driving growth and expansion throughout the region. Leveraging Google Cloud, Niveus facilitates the seamless adoption and implementation of cloud solutions, empowering businesses to scale rapidly and capitalize on new opportunities. - - "We're proud of the achievements we've made in the previous year and are excited to be named Google Cloud Services Partner of the Year - Asia Pacific and Google Cloud Expansion Partner of the Year - Asia Pacific. We are recognized for our strong partnership with Google Cloud and our best-in-class use of Google Cloud products and services, coupled with our expertise. Winning this prestigious award is a true testament to our agility, innovative leadership, exceptional customer service, and the remarkable growth that we have achieved," said Suyog Shetty, CEO of Niveus Solutions. - - In the previous year, Niveus achieved Infrastructure, Application development, and Data Management Specializations, acquiring 21 new areas of expertise and 167 Professional Google Cloud certifications. They were also recognized as a Google Cloud Regional AlloyDB partner. Notably, their collaboration on an automotive bookings platform resulted in record-breaking sales and improved customer satisfaction. Niveus expanded its team to over 900+ employees across 6+ locations and successfully entered the SEA market. They aim to replicate their success in India with Google in other international markets. Niveus strengthened its presence in the BFSI & DN space and expanded sales capacity to cover other industries like Manufacturing, CPG, and Conglomerates, successfully closing deals with various clients. - - Niveus Solutions Pvt. Ltd. is a cloud-born engineering services organization founded in 2013. Niveus progressed rapidly over the years with the company making a strategic decision in 2019 to exclusively partner with Google Cloud, securing 'Premier Partner status in less than 2 years. Niveus empowers enterprises to harness the power of cloud services and build resilient infrastructures that scale. Niveus specializes in application, infrastructure, & data modernization, data management, cloud consulting, security, & managed services. - `; - setText(sampleText); - }; - - // let request_id = request_id; - - return ( - <div className="container"> - <div className="news-container"> - <h2 className="sub-heading">News</h2> - <div className="sample-container"> - <label className="sample"> - <input - type="checkbox" - name="sampleData" - onClick={fillWithSampleData} - /> - Sample - </label> - </div> - <div className="textarea-container"> - <textarea - // rows="16" - // cols="120" - value={text} - onChange={(e) => setText(e.target.value)} - placeholder="Enter news text here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetSummary}> - Get Summary - </button> - </div> - )} - </div> - - <Summary summary={summary} requestId={request_id} /> - </div> - ); -} - -export default News; diff --git a/.history/src/News_20240206123013.js b/.history/src/News_20240206123013.js deleted file mode 100644 index fe04a8a0726ffc255458fa245605833b4eec1ddc..0000000000000000000000000000000000000000 --- a/.history/src/News_20240206123013.js +++ /dev/null @@ -1,167 +0,0 @@ -import { useState } from "react"; -import Summary from "./Summary"; - -function News() { - const [text, setText] = useState(""); - const [summary, setSummary] = useState(""); - const [loading, setLoading] = useState(false); - const [request_id, setRequestId] = useState(null); - - // let random_num = Math.floor(Math.random() * 1000); - // let request_id = random_num; - // let request_id = 123; - - function processNewsText(rawText) { - // Replace " with ' - let news = rawText.replace(/"/g, "'"); - - // Replace \n with space - news = news.replace(/\n/g, " "); - - // Replace \t with space - news = news.replace(/\t/g, " "); - - // Replace \r with space - news = news.replace(/\r/g, " "); - - // Replace ; with space - news = news.replace(/;/g, " "); - - // Replace # with space - news = news.replace(/#/g, " "); - - // Replace -- with space - news = news.replace(/--/g, " "); - - // Replace - with space - news = news.replace(/-/g, " "); - - // Replace () with space - news = news.replace(/\(/g, " "); - news = news.replace(/\)/g, " "); - - return news; - } - - const handleGetSummary = async () => { - if (text) { - setLoading(true); - // let request_id = 123; - let request_id = Math.floor(Math.random() * 1000); - setRequestId(request_id); - // console.log("Text>>>> ", text); - processNewsText = await processNewsText(text); - // console.log(processNewsText); - // console.log(request_id); - - // Set a flag to track if a response has been received - let responseReceived = false; - - // Set a timeout of 40 seconds (40,000 milliseconds) - const timeout = 90000; - - const timeoutId = setTimeout(() => { - if (!responseReceived) { - // Alert the user if no response has been received within the timeout - alert( - "Server is Busy processing another request. We have put you on queue!" - ); - setLoading(false); // Reset loading state - } - }, timeout); - - try { - const response = await fetch( - "https://texttovideo.ns-devsecops/summarize", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text: processNewsText, request_id }), - } - ); - if (response.ok) { - clearTimeout(timeoutId); // Clear the timeout if response is received - const data = await response.json(); - // console.log(data); - setSummary(data.summary); - responseReceived = true; - } else { - console.error("Failed to fetch summary"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } else { - alert("Please enter news!!"); - } - }; - - // request_id = request_id; - // console.log(request_id); - - const fillWithSampleData = () => { - const sampleText = `New Delhi (India), August 29: Niveus Solutions, a cloud engineering organization, announced today that it has received the 2023 Google Cloud Partner of the Year Awards for two categories: Google Cloud Services Partner of the Year - Asia Pacific' and 'Google Cloud Expansion Partner of the Year - Asia Pacific'. This marks the second time that Niveus has been recognized by Google Cloud for their outstanding achievements. - - Niveus Solutions was recognized for its achievements in the Google Cloud ecosystem, helping customers across BFSI, Automotive, Media & Entertainment, Manufacturing, PSUs, and Digital Natives industries. Nievus is also recognized for its deep cloud transformation experience within the Asia Pacific region and its comprehensive and compelling digital solutions that are transforming the way industries work. - - "Google Cloud's partner awards recognize the significant impact and customer success that our partners have driven over the past year," said Kevin Ichhpurani, Corporate Vice President of global Ecosystem and Channels at Google Cloud. "We're delighted to recognize Niveus Solutions as a 2023 Google Cloud Partner Award winner, and look forward to a continued strong partnership in support of our mutual customers." - - The Google Cloud Service Partner of the Year - Asia Pacific award recognizes Niveus' commitment to enabling global innovators across diverse industries in their digital transformation. With exceptional technical capabilities and top-tier service offerings, Niveus is committed to delivering outstanding Google Cloud products and solutions as a Service Partner. Niveus' recognition as the Google Cloud Expansion Partner of the Year - Asia Pacific is a testament to its focus on driving growth and expansion throughout the region. Leveraging Google Cloud, Niveus facilitates the seamless adoption and implementation of cloud solutions, empowering businesses to scale rapidly and capitalize on new opportunities. - - "We're proud of the achievements we've made in the previous year and are excited to be named Google Cloud Services Partner of the Year - Asia Pacific and Google Cloud Expansion Partner of the Year - Asia Pacific. We are recognized for our strong partnership with Google Cloud and our best-in-class use of Google Cloud products and services, coupled with our expertise. Winning this prestigious award is a true testament to our agility, innovative leadership, exceptional customer service, and the remarkable growth that we have achieved," said Suyog Shetty, CEO of Niveus Solutions. - - In the previous year, Niveus achieved Infrastructure, Application development, and Data Management Specializations, acquiring 21 new areas of expertise and 167 Professional Google Cloud certifications. They were also recognized as a Google Cloud Regional AlloyDB partner. Notably, their collaboration on an automotive bookings platform resulted in record-breaking sales and improved customer satisfaction. Niveus expanded its team to over 900+ employees across 6+ locations and successfully entered the SEA market. They aim to replicate their success in India with Google in other international markets. Niveus strengthened its presence in the BFSI & DN space and expanded sales capacity to cover other industries like Manufacturing, CPG, and Conglomerates, successfully closing deals with various clients. - - Niveus Solutions Pvt. Ltd. is a cloud-born engineering services organization founded in 2013. Niveus progressed rapidly over the years with the company making a strategic decision in 2019 to exclusively partner with Google Cloud, securing 'Premier Partner status in less than 2 years. Niveus empowers enterprises to harness the power of cloud services and build resilient infrastructures that scale. Niveus specializes in application, infrastructure, & data modernization, data management, cloud consulting, security, & managed services. - `; - setText(sampleText); - }; - - // let request_id = request_id; - - return ( - <div className="container"> - <div className="news-container"> - <h2 className="sub-heading">News</h2> - <div className="sample-container"> - <label className="sample"> - <input - type="checkbox" - name="sampleData" - onClick={fillWithSampleData} - /> - Sample - </label> - </div> - <div className="textarea-container"> - <textarea - // rows="16" - // cols="120" - value={text} - onChange={(e) => setText(e.target.value)} - placeholder="Enter news text here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetSummary}> - Get Summary - </button> - </div> - )} - </div> - - <Summary summary={summary} requestId={request_id} /> - </div> - ); -} - -export default News; diff --git a/.history/src/News_20240206123040.js b/.history/src/News_20240206123040.js deleted file mode 100644 index 102b54251250deb107cabb629746d870db160b6b..0000000000000000000000000000000000000000 --- a/.history/src/News_20240206123040.js +++ /dev/null @@ -1,167 +0,0 @@ -import { useState } from "react"; -import Summary from "./Summary"; - -function News() { - const [text, setText] = useState(""); - const [summary, setSummary] = useState(""); - const [loading, setLoading] = useState(false); - const [request_id, setRequestId] = useState(null); - - // let random_num = Math.floor(Math.random() * 1000); - // let request_id = random_num; - // let request_id = 123; - - function processNewsText(rawText) { - // Replace " with ' - let news = rawText.replace(/"/g, "'"); - - // Replace \n with space - news = news.replace(/\n/g, " "); - - // Replace \t with space - news = news.replace(/\t/g, " "); - - // Replace \r with space - news = news.replace(/\r/g, " "); - - // Replace ; with space - news = news.replace(/;/g, " "); - - // Replace # with space - news = news.replace(/#/g, " "); - - // Replace -- with space - news = news.replace(/--/g, " "); - - // Replace - with space - news = news.replace(/-/g, " "); - - // Replace () with space - news = news.replace(/\(/g, " "); - news = news.replace(/\)/g, " "); - - return news; - } - - const handleGetSummary = async () => { - if (text) { - setLoading(true); - // let request_id = 123; - let request_id = Math.floor(Math.random() * 1000); - setRequestId(request_id); - // console.log("Text>>>> ", text); - processNewsText = await processNewsText(text); - // console.log(processNewsText); - // console.log(request_id); - - // Set a flag to track if a response has been received - let responseReceived = false; - - // Set a timeout of 40 seconds (40,000 milliseconds) - const timeout = 90000; - - const timeoutId = setTimeout(() => { - if (!responseReceived) { - // Alert the user if no response has been received within the timeout - alert( - "Server is Busy processing another request. We have put you on queue!" - ); - setLoading(false); // Reset loading state - } - }, timeout); - - try { - const response = await fetch( - "https://texttovideo.ns-devsecops.com/summarize", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text: processNewsText, request_id }), - } - ); - if (response.ok) { - clearTimeout(timeoutId); // Clear the timeout if response is received - const data = await response.json(); - // console.log(data); - setSummary(data.summary); - responseReceived = true; - } else { - console.error("Failed to fetch summary"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } else { - alert("Please enter news!!"); - } - }; - - // request_id = request_id; - // console.log(request_id); - - const fillWithSampleData = () => { - const sampleText = `New Delhi (India), August 29: Niveus Solutions, a cloud engineering organization, announced today that it has received the 2023 Google Cloud Partner of the Year Awards for two categories: Google Cloud Services Partner of the Year - Asia Pacific' and 'Google Cloud Expansion Partner of the Year - Asia Pacific'. This marks the second time that Niveus has been recognized by Google Cloud for their outstanding achievements. - - Niveus Solutions was recognized for its achievements in the Google Cloud ecosystem, helping customers across BFSI, Automotive, Media & Entertainment, Manufacturing, PSUs, and Digital Natives industries. Nievus is also recognized for its deep cloud transformation experience within the Asia Pacific region and its comprehensive and compelling digital solutions that are transforming the way industries work. - - "Google Cloud's partner awards recognize the significant impact and customer success that our partners have driven over the past year," said Kevin Ichhpurani, Corporate Vice President of global Ecosystem and Channels at Google Cloud. "We're delighted to recognize Niveus Solutions as a 2023 Google Cloud Partner Award winner, and look forward to a continued strong partnership in support of our mutual customers." - - The Google Cloud Service Partner of the Year - Asia Pacific award recognizes Niveus' commitment to enabling global innovators across diverse industries in their digital transformation. With exceptional technical capabilities and top-tier service offerings, Niveus is committed to delivering outstanding Google Cloud products and solutions as a Service Partner. Niveus' recognition as the Google Cloud Expansion Partner of the Year - Asia Pacific is a testament to its focus on driving growth and expansion throughout the region. Leveraging Google Cloud, Niveus facilitates the seamless adoption and implementation of cloud solutions, empowering businesses to scale rapidly and capitalize on new opportunities. - - "We're proud of the achievements we've made in the previous year and are excited to be named Google Cloud Services Partner of the Year - Asia Pacific and Google Cloud Expansion Partner of the Year - Asia Pacific. We are recognized for our strong partnership with Google Cloud and our best-in-class use of Google Cloud products and services, coupled with our expertise. Winning this prestigious award is a true testament to our agility, innovative leadership, exceptional customer service, and the remarkable growth that we have achieved," said Suyog Shetty, CEO of Niveus Solutions. - - In the previous year, Niveus achieved Infrastructure, Application development, and Data Management Specializations, acquiring 21 new areas of expertise and 167 Professional Google Cloud certifications. They were also recognized as a Google Cloud Regional AlloyDB partner. Notably, their collaboration on an automotive bookings platform resulted in record-breaking sales and improved customer satisfaction. Niveus expanded its team to over 900+ employees across 6+ locations and successfully entered the SEA market. They aim to replicate their success in India with Google in other international markets. Niveus strengthened its presence in the BFSI & DN space and expanded sales capacity to cover other industries like Manufacturing, CPG, and Conglomerates, successfully closing deals with various clients. - - Niveus Solutions Pvt. Ltd. is a cloud-born engineering services organization founded in 2013. Niveus progressed rapidly over the years with the company making a strategic decision in 2019 to exclusively partner with Google Cloud, securing 'Premier Partner status in less than 2 years. Niveus empowers enterprises to harness the power of cloud services and build resilient infrastructures that scale. Niveus specializes in application, infrastructure, & data modernization, data management, cloud consulting, security, & managed services. - `; - setText(sampleText); - }; - - // let request_id = request_id; - - return ( - <div className="container"> - <div className="news-container"> - <h2 className="sub-heading">News</h2> - <div className="sample-container"> - <label className="sample"> - <input - type="checkbox" - name="sampleData" - onClick={fillWithSampleData} - /> - Sample - </label> - </div> - <div className="textarea-container"> - <textarea - // rows="16" - // cols="120" - value={text} - onChange={(e) => setText(e.target.value)} - placeholder="Enter news text here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetSummary}> - Get Summary - </button> - </div> - )} - </div> - - <Summary summary={summary} requestId={request_id} /> - </div> - ); -} - -export default News; diff --git a/.history/src/News_20240206130102.js b/.history/src/News_20240206130102.js deleted file mode 100644 index a40bc27e046c15411ba3776a7ed14ffc54e31a2b..0000000000000000000000000000000000000000 --- a/.history/src/News_20240206130102.js +++ /dev/null @@ -1,167 +0,0 @@ -import { useState } from "react"; -import Summary from "./Summary"; - -function News() { - const [text, setText] = useState(""); - const [summary, setSummary] = useState(""); - const [loading, setLoading] = useState(false); - const [request_id, setRequestId] = useState(null); - - // let random_num = Math.floor(Math.random() * 1000); - // let request_id = random_num; - // let request_id = 123; - - function processNewsText(rawText) { - // Replace " with ' - let news = rawText.replace(/"/g, "'"); - - // Replace \n with space - news = news.replace(/\n/g, " "); - - // Replace \t with space - news = news.replace(/\t/g, " "); - - // Replace \r with space - news = news.replace(/\r/g, " "); - - // Replace ; with space - news = news.replace(/;/g, " "); - - // Replace # with space - news = news.replace(/#/g, " "); - - // Replace -- with space - news = news.replace(/--/g, " "); - - // Replace - with space - news = news.replace(/-/g, " "); - - // Replace () with space - news = news.replace(/\(/g, " "); - news = news.replace(/\)/g, " "); - - return news; - } - - const handleGetSummary = async () => { - if (text) { - setLoading(true); - // let request_id = 123; - let request_id = Math.floor(Math.random() * 1000); - setRequestId(request_id); - // console.log("Text>>>> ", text); - processNewsText = await processNewsText(text); - // console.log(processNewsText); - // console.log(request_id); - - // Set a flag to track if a response has been received - let responseReceived = false; - - // Set a timeout of 40 seconds (40,000 milliseconds) - const timeout = 90000; - - const timeoutId = setTimeout(() => { - if (!responseReceived) { - // Alert the user if no response has been received within the timeout - alert( - "Server is Busy processing another request. We have put you on queue!" - ); - setLoading(false); // Reset loading state - } - }, timeout); - - try { - const response = await fetch( - "https://cors-anywhere.herokuapp.com/https://texttovideo.ns-cops.com/summarize", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text: processNewsText, request_id }), - } - ); - if (response.ok) { - clearTimeout(timeoutId); // Clear the timeout if response is received - const data = await response.json(); - // console.log(data); - setSummary(data.summary); - responseReceived = true; - } else { - console.error("Failed to fetch summary"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } else { - alert("Please enter news!!"); - } - }; - - // request_id = request_id; - // console.log(request_id); - - const fillWithSampleData = () => { - const sampleText = `New Delhi (India), August 29: Niveus Solutions, a cloud engineering organization, announced today that it has received the 2023 Google Cloud Partner of the Year Awards for two categories: Google Cloud Services Partner of the Year - Asia Pacific' and 'Google Cloud Expansion Partner of the Year - Asia Pacific'. This marks the second time that Niveus has been recognized by Google Cloud for their outstanding achievements. - - Niveus Solutions was recognized for its achievements in the Google Cloud ecosystem, helping customers across BFSI, Automotive, Media & Entertainment, Manufacturing, PSUs, and Digital Natives industries. Nievus is also recognized for its deep cloud transformation experience within the Asia Pacific region and its comprehensive and compelling digital solutions that are transforming the way industries work. - - "Google Cloud's partner awards recognize the significant impact and customer success that our partners have driven over the past year," said Kevin Ichhpurani, Corporate Vice President of global Ecosystem and Channels at Google Cloud. "We're delighted to recognize Niveus Solutions as a 2023 Google Cloud Partner Award winner, and look forward to a continued strong partnership in support of our mutual customers." - - The Google Cloud Service Partner of the Year - Asia Pacific award recognizes Niveus' commitment to enabling global innovators across diverse industries in their digital transformation. With exceptional technical capabilities and top-tier service offerings, Niveus is committed to delivering outstanding Google Cloud products and solutions as a Service Partner. Niveus' recognition as the Google Cloud Expansion Partner of the Year - Asia Pacific is a testament to its focus on driving growth and expansion throughout the region. Leveraging Google Cloud, Niveus facilitates the seamless adoption and implementation of cloud solutions, empowering businesses to scale rapidly and capitalize on new opportunities. - - "We're proud of the achievements we've made in the previous year and are excited to be named Google Cloud Services Partner of the Year - Asia Pacific and Google Cloud Expansion Partner of the Year - Asia Pacific. We are recognized for our strong partnership with Google Cloud and our best-in-class use of Google Cloud products and services, coupled with our expertise. Winning this prestigious award is a true testament to our agility, innovative leadership, exceptional customer service, and the remarkable growth that we have achieved," said Suyog Shetty, CEO of Niveus Solutions. - - In the previous year, Niveus achieved Infrastructure, Application development, and Data Management Specializations, acquiring 21 new areas of expertise and 167 Professional Google Cloud certifications. They were also recognized as a Google Cloud Regional AlloyDB partner. Notably, their collaboration on an automotive bookings platform resulted in record-breaking sales and improved customer satisfaction. Niveus expanded its team to over 900+ employees across 6+ locations and successfully entered the SEA market. They aim to replicate their success in India with Google in other international markets. Niveus strengthened its presence in the BFSI & DN space and expanded sales capacity to cover other industries like Manufacturing, CPG, and Conglomerates, successfully closing deals with various clients. - - Niveus Solutions Pvt. Ltd. is a cloud-born engineering services organization founded in 2013. Niveus progressed rapidly over the years with the company making a strategic decision in 2019 to exclusively partner with Google Cloud, securing 'Premier Partner status in less than 2 years. Niveus empowers enterprises to harness the power of cloud services and build resilient infrastructures that scale. Niveus specializes in application, infrastructure, & data modernization, data management, cloud consulting, security, & managed services. - `; - setText(sampleText); - }; - - // let request_id = request_id; - - return ( - <div className="container"> - <div className="news-container"> - <h2 className="sub-heading">News</h2> - <div className="sample-container"> - <label className="sample"> - <input - type="checkbox" - name="sampleData" - onClick={fillWithSampleData} - /> - Sample - </label> - </div> - <div className="textarea-container"> - <textarea - // rows="16" - // cols="120" - value={text} - onChange={(e) => setText(e.target.value)} - placeholder="Enter news text here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetSummary}> - Get Summary - </button> - </div> - )} - </div> - - <Summary summary={summary} requestId={request_id} /> - </div> - ); -} - -export default News; diff --git a/.history/src/News_20240206130120.js b/.history/src/News_20240206130120.js deleted file mode 100644 index 102b54251250deb107cabb629746d870db160b6b..0000000000000000000000000000000000000000 --- a/.history/src/News_20240206130120.js +++ /dev/null @@ -1,167 +0,0 @@ -import { useState } from "react"; -import Summary from "./Summary"; - -function News() { - const [text, setText] = useState(""); - const [summary, setSummary] = useState(""); - const [loading, setLoading] = useState(false); - const [request_id, setRequestId] = useState(null); - - // let random_num = Math.floor(Math.random() * 1000); - // let request_id = random_num; - // let request_id = 123; - - function processNewsText(rawText) { - // Replace " with ' - let news = rawText.replace(/"/g, "'"); - - // Replace \n with space - news = news.replace(/\n/g, " "); - - // Replace \t with space - news = news.replace(/\t/g, " "); - - // Replace \r with space - news = news.replace(/\r/g, " "); - - // Replace ; with space - news = news.replace(/;/g, " "); - - // Replace # with space - news = news.replace(/#/g, " "); - - // Replace -- with space - news = news.replace(/--/g, " "); - - // Replace - with space - news = news.replace(/-/g, " "); - - // Replace () with space - news = news.replace(/\(/g, " "); - news = news.replace(/\)/g, " "); - - return news; - } - - const handleGetSummary = async () => { - if (text) { - setLoading(true); - // let request_id = 123; - let request_id = Math.floor(Math.random() * 1000); - setRequestId(request_id); - // console.log("Text>>>> ", text); - processNewsText = await processNewsText(text); - // console.log(processNewsText); - // console.log(request_id); - - // Set a flag to track if a response has been received - let responseReceived = false; - - // Set a timeout of 40 seconds (40,000 milliseconds) - const timeout = 90000; - - const timeoutId = setTimeout(() => { - if (!responseReceived) { - // Alert the user if no response has been received within the timeout - alert( - "Server is Busy processing another request. We have put you on queue!" - ); - setLoading(false); // Reset loading state - } - }, timeout); - - try { - const response = await fetch( - "https://texttovideo.ns-devsecops.com/summarize", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text: processNewsText, request_id }), - } - ); - if (response.ok) { - clearTimeout(timeoutId); // Clear the timeout if response is received - const data = await response.json(); - // console.log(data); - setSummary(data.summary); - responseReceived = true; - } else { - console.error("Failed to fetch summary"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } else { - alert("Please enter news!!"); - } - }; - - // request_id = request_id; - // console.log(request_id); - - const fillWithSampleData = () => { - const sampleText = `New Delhi (India), August 29: Niveus Solutions, a cloud engineering organization, announced today that it has received the 2023 Google Cloud Partner of the Year Awards for two categories: Google Cloud Services Partner of the Year - Asia Pacific' and 'Google Cloud Expansion Partner of the Year - Asia Pacific'. This marks the second time that Niveus has been recognized by Google Cloud for their outstanding achievements. - - Niveus Solutions was recognized for its achievements in the Google Cloud ecosystem, helping customers across BFSI, Automotive, Media & Entertainment, Manufacturing, PSUs, and Digital Natives industries. Nievus is also recognized for its deep cloud transformation experience within the Asia Pacific region and its comprehensive and compelling digital solutions that are transforming the way industries work. - - "Google Cloud's partner awards recognize the significant impact and customer success that our partners have driven over the past year," said Kevin Ichhpurani, Corporate Vice President of global Ecosystem and Channels at Google Cloud. "We're delighted to recognize Niveus Solutions as a 2023 Google Cloud Partner Award winner, and look forward to a continued strong partnership in support of our mutual customers." - - The Google Cloud Service Partner of the Year - Asia Pacific award recognizes Niveus' commitment to enabling global innovators across diverse industries in their digital transformation. With exceptional technical capabilities and top-tier service offerings, Niveus is committed to delivering outstanding Google Cloud products and solutions as a Service Partner. Niveus' recognition as the Google Cloud Expansion Partner of the Year - Asia Pacific is a testament to its focus on driving growth and expansion throughout the region. Leveraging Google Cloud, Niveus facilitates the seamless adoption and implementation of cloud solutions, empowering businesses to scale rapidly and capitalize on new opportunities. - - "We're proud of the achievements we've made in the previous year and are excited to be named Google Cloud Services Partner of the Year - Asia Pacific and Google Cloud Expansion Partner of the Year - Asia Pacific. We are recognized for our strong partnership with Google Cloud and our best-in-class use of Google Cloud products and services, coupled with our expertise. Winning this prestigious award is a true testament to our agility, innovative leadership, exceptional customer service, and the remarkable growth that we have achieved," said Suyog Shetty, CEO of Niveus Solutions. - - In the previous year, Niveus achieved Infrastructure, Application development, and Data Management Specializations, acquiring 21 new areas of expertise and 167 Professional Google Cloud certifications. They were also recognized as a Google Cloud Regional AlloyDB partner. Notably, their collaboration on an automotive bookings platform resulted in record-breaking sales and improved customer satisfaction. Niveus expanded its team to over 900+ employees across 6+ locations and successfully entered the SEA market. They aim to replicate their success in India with Google in other international markets. Niveus strengthened its presence in the BFSI & DN space and expanded sales capacity to cover other industries like Manufacturing, CPG, and Conglomerates, successfully closing deals with various clients. - - Niveus Solutions Pvt. Ltd. is a cloud-born engineering services organization founded in 2013. Niveus progressed rapidly over the years with the company making a strategic decision in 2019 to exclusively partner with Google Cloud, securing 'Premier Partner status in less than 2 years. Niveus empowers enterprises to harness the power of cloud services and build resilient infrastructures that scale. Niveus specializes in application, infrastructure, & data modernization, data management, cloud consulting, security, & managed services. - `; - setText(sampleText); - }; - - // let request_id = request_id; - - return ( - <div className="container"> - <div className="news-container"> - <h2 className="sub-heading">News</h2> - <div className="sample-container"> - <label className="sample"> - <input - type="checkbox" - name="sampleData" - onClick={fillWithSampleData} - /> - Sample - </label> - </div> - <div className="textarea-container"> - <textarea - // rows="16" - // cols="120" - value={text} - onChange={(e) => setText(e.target.value)} - placeholder="Enter news text here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetSummary}> - Get Summary - </button> - </div> - )} - </div> - - <Summary summary={summary} requestId={request_id} /> - </div> - ); -} - -export default News; diff --git a/.history/src/Summary_20240202134625.js b/.history/src/Summary_20240202134625.js deleted file mode 100644 index d35365efabb48113ffca494b2979713d88367bd9..0000000000000000000000000000000000000000 --- a/.history/src/Summary_20240202134625.js +++ /dev/null @@ -1,86 +0,0 @@ -// Summary.js -import React, { useEffect, useState } from "react"; -import Video from "./Video"; -import Audio from "./Audio"; - -function Summary({ summary, requestId }) { - const [audioResponse, setAudioResponse] = useState(""); // State to store video response - // const [audioDisplay, setAudioDisplay] = useState(""); - const [loading, setLoading] = useState(false); - // console.log(requestId); - - const handleGetAudio = async () => { - if (summary) { - setLoading(true); - let request_id = requestId; - // console.log(summary); - // console.log(request_id); - let text = summary; - try { - // 34.41.231.47:8000 - - const response = await fetch("http://34.160.236.91:8000/get_audio", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text, request_id }), // Send the summary as the request - }); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.audio); - // const audioObjectUrl = URL.createObjectURL(data.audio); - // console.log(audioObjectUrl); - setAudioResponse(data.audio); - // setAudioDisplay() - // console.log(audioResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - // console.log("Updated audioResponse:", audioResponse); - }, [audioResponse]); - - return ( - <div className="container"> - <div className="summary-container"> - <h2 className="sub-heading">Summary</h2> - <div> - <textarea - className="summary-texarea" - // rows="6" - // cols="120" - value={summary} - readOnly - placeholder="Summary will display here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetAudio}> - Get Audio - </button> - </div> - )} - </div> - - <Audio audioResponse={audioResponse} requestId={requestId} /> - {/* Pass videoResponse as prop */} - </div> - ); -} - -export default Summary; diff --git a/.history/src/Summary_20240205114715.js b/.history/src/Summary_20240205114715.js deleted file mode 100644 index 9651d4e33db1a2f6b7cce591adf207ed82ae9d30..0000000000000000000000000000000000000000 --- a/.history/src/Summary_20240205114715.js +++ /dev/null @@ -1,86 +0,0 @@ -// Summary.js -import React, { useEffect, useState } from "react"; -import Video from "./Video"; -import Audio from "./Audio"; - -function Summary({ summary, requestId }) { - const [audioResponse, setAudioResponse] = useState(""); // State to store video response - // const [audioDisplay, setAudioDisplay] = useState(""); - const [loading, setLoading] = useState(false); - // console.log(requestId); - - const handleGetAudio = async () => { - if (summary) { - setLoading(true); - let request_id = requestId; - // console.log(summary); - // console.log(request_id); - let text = summary; - try { - // 34.41.231.47:8000 - - const response = await fetch("http://34.160.236.91/get_audio", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text, request_id }), // Send the summary as the request - }); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.audio); - // const audioObjectUrl = URL.createObjectURL(data.audio); - // console.log(audioObjectUrl); - setAudioResponse(data.audio); - // setAudioDisplay() - // console.log(audioResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - // console.log("Updated audioResponse:", audioResponse); - }, [audioResponse]); - - return ( - <div className="container"> - <div className="summary-container"> - <h2 className="sub-heading">Summary</h2> - <div> - <textarea - className="summary-texarea" - // rows="6" - // cols="120" - value={summary} - readOnly - placeholder="Summary will display here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetAudio}> - Get Audio - </button> - </div> - )} - </div> - - <Audio audioResponse={audioResponse} requestId={requestId} /> - {/* Pass videoResponse as prop */} - </div> - ); -} - -export default Summary; diff --git a/.history/src/Summary_20240205175528.js b/.history/src/Summary_20240205175528.js deleted file mode 100644 index 643a4f4c7213a16d26059cec8f6b9a9deef8eb28..0000000000000000000000000000000000000000 --- a/.history/src/Summary_20240205175528.js +++ /dev/null @@ -1,86 +0,0 @@ -// Summary.js -import React, { useEffect, useState } from "react"; -import Video from "./Video"; -import Audio from "./Audio"; - -function Summary({ summary, requestId }) { - const [audioResponse, setAudioResponse] = useState(""); // State to store video response - // const [audioDisplay, setAudioDisplay] = useState(""); - const [loading, setLoading] = useState(false); - // console.log(requestId); - - const handleGetAudio = async () => { - if (summary) { - setLoading(true); - let request_id = requestId; - // console.log(summary); - // console.log(request_id); - let text = summary; - try { - // 34.41.231.47:8000 - - const response = await fetch("https://34.160.236.91/get_audio", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text, request_id }), // Send the summary as the request - }); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.audio); - // const audioObjectUrl = URL.createObjectURL(data.audio); - // console.log(audioObjectUrl); - setAudioResponse(data.audio); - // setAudioDisplay() - // console.log(audioResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - // console.log("Updated audioResponse:", audioResponse); - }, [audioResponse]); - - return ( - <div className="container"> - <div className="summary-container"> - <h2 className="sub-heading">Summary</h2> - <div> - <textarea - className="summary-texarea" - // rows="6" - // cols="120" - value={summary} - readOnly - placeholder="Summary will display here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetAudio}> - Get Audio - </button> - </div> - )} - </div> - - <Audio audioResponse={audioResponse} requestId={requestId} /> - {/* Pass videoResponse as prop */} - </div> - ); -} - -export default Summary; diff --git a/.history/src/Summary_20240206122743.js b/.history/src/Summary_20240206122743.js deleted file mode 100644 index 59f543834aeb020035f237fbd278789011c1b9ae..0000000000000000000000000000000000000000 --- a/.history/src/Summary_20240206122743.js +++ /dev/null @@ -1,89 +0,0 @@ -// Summary.js -import React, { useEffect, useState } from "react"; -import Video from "./Video"; -import Audio from "./Audio"; - -function Summary({ summary, requestId }) { - const [audioResponse, setAudioResponse] = useState(""); // State to store video response - // const [audioDisplay, setAudioDisplay] = useState(""); - const [loading, setLoading] = useState(false); - // console.log(requestId); - - const handleGetAudio = async () => { - if (summary) { - setLoading(true); - let request_id = requestId; - // console.log(summary); - // console.log(request_id); - let text = summary; - try { - // 34.41.231.47:8000 - - const response = await fetch( - "https://texttovideo.ns-devsecops.com/get_audio", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ text, request_id }), // Send the summary as the request - } - ); - if (response.ok) { - const data = await response.json(); // Assuming the response is text - // console.log(data); - // console.log(data.audio); - // const audioObjectUrl = URL.createObjectURL(data.audio); - // console.log(audioObjectUrl); - setAudioResponse(data.audio); - // setAudioDisplay() - // console.log(audioResponse); - } else { - console.error("Failed to fetch video"); - } - } catch (error) { - console.error("Error:", error); - } finally { - setLoading(false); - } - } - }; - - useEffect(() => { - // console.log("Updated audioResponse:", audioResponse); - }, [audioResponse]); - - return ( - <div className="container"> - <div className="summary-container"> - <h2 className="sub-heading">Summary</h2> - <div> - <textarea - className="summary-texarea" - // rows="6" - // cols="120" - value={summary} - readOnly - placeholder="Summary will display here..." - /> - </div> - {loading ? ( - <div> - <button className="generating-button">Generating...</button> - </div> - ) : ( - <div> - <button className="button" onClick={handleGetAudio}> - Get Audio - </button> - </div> - )} - </div> - - <Audio audioResponse={audioResponse} requestId={requestId} /> - {/* Pass videoResponse as prop */} - </div> - ); -} - -export default Summary;