diff --git a/src/Pages/AiServices.jsx b/src/Pages/AiServices.jsx
index 19a2fe2..b82cd62 100644
--- a/src/Pages/AiServices.jsx
+++ b/src/Pages/AiServices.jsx
@@ -31,6 +31,7 @@ const AiServices = ({ isDarkMode }) => {
icon: ,
title: "Summarization",
description: "Summarize long documents, articles, or reports into concise overviews.",
+ link: '/services/summarize'
},
]
//TODO: To be implemented
diff --git a/src/Pages/Summarize.jsx b/src/Pages/Summarize.jsx
new file mode 100644
index 0000000..855b2a3
--- /dev/null
+++ b/src/Pages/Summarize.jsx
@@ -0,0 +1,63 @@
+import { useRef, useState } from 'react';
+import axios from 'axios';
+import '../Components/ImageGenerator/ImageGenerator.css';
+import Swal from 'sweetalert2';
+
+const Summarize = ({ isDarkMode }) => {
+ const [summary, setSummary] = useState('');
+ const [loading, setLoading] = useState(false);
+ const inputReference = useRef(null);
+
+ const handleSummarize = async () => {
+ if (inputReference.current.value === '') {
+ // alert('Please enter some text to summarize.');
+ Swal.fire({
+ icon: 'error',
+ title: 'Oops...',
+ text: "Please enter some text to summarize",
+ });
+ return;
+ }
+ setLoading(true);
+ try {
+ const response = await axios.post('YOUR_OPENAI_API_ENDPOINT', {
+ text: inputReference.current.value
+ }, {
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`
+ }
+ });
+
+ setSummary(response.data.summary);
+ setLoading(false);
+ } catch (error) {
+ console.error('Error generating summary:', error);
+ Swal.fire({
+ icon: 'error',
+ title: 'Oops...',
+ text: 'Failed to generate summary. Please try again later.'
+ });
+ setLoading(false);
+ }
+ };
+
+ return (
+
+
Text Summarization
+
+
+
+
+ {loading &&
Loading...
}
+ {summary && (
+
+ )}
+
+ );
+}
+
+export default Summarize;