- Text Summarization
Enter a large block of text (min. 200 characters) and click the "Summarize" button to generate a concise summary.
- Text-to-Image Generation
Enter a text description of the image you want, and click the "Generate Image" button to generate an image.
This is a full-stack web application built with Node.js and Express.js that demonstrates the power of AI by integrating two APIs:
- Text Summarization using Hugging Face's BART Large CNN model.
- Text-to-Image Generation using Hugging Face's Text-to-Image API.
The application provides a user-friendly interface to summarize large blocks of text and generate images based on text descriptions.
- Features
- Technologies Used
- File Breakdown
- Setup Instructions
- How to Use
- Project Flow
- Acknowledgments
-
AI Text Summarization
- Input: Large text blocks (min. 200 characters).
- Output: A concise summary generated using the BART Large CNN model.
-
Text-to-Image Generation
- Input: Text describing an image.
- Output: An AI-generated image in PNG format.
-
Environment Configuration
- API keys are hidden using
dotenv
. - Users can either create a
.env
file or directly replace theACCESS_TOKEN
in the code.
- API keys are hidden using
-
Responsive Design
- Clean, user-friendly interface styled with CSS.
-
Cross-Origin Request Handling
- Enabled using the
CORS
library for smooth client-server communication.
- Enabled using the
- HTML, CSS, JavaScript for UI and interactivity.
- Node.js and Express.js for server-side logic and routing.
- Text Summarization API: Hugging Face's BART Large CNN model.
- Image Generation API: Hugging Face's Text-to-Image model.
- Axios: For making HTTP requests.
- dotenv: For securely handling API keys.
- CORS: For enabling cross-origin requests.
- Text Summarization Section: Input textarea and summarize button.
- Image Generation Section: Input textarea and generate image button.
- Links to
stylesheet.css
andscript.js
.
- Configures middleware (
CORS
,express.json
,express.static
). - Defines two API routes:
/summarize
: Handles text summarization requests./convert-to-image
: Handles text-to-image conversion requests.
- Implements the logic for calling the Text Summarization API.
- Validates input and uses the
ACCESS_TOKEN
for authorization.
- Implements the logic for calling the Text-to-Image API.
- Dynamically calculates image size based on text length.
- Adds interactivity to the web page (button click handling, API requests, error management).
- Styles the app with a clean and responsive design.
-
Clone the Repository:
git clone https://github.com/medss19/PostmanAPI.git cd PostmanAPI
-
Install Dependencies:
npm install
-
Set Up Environment Variables:
- Create a
.env
file in the project root directory. - Add your Hugging Face API token:
ACCESS_TOKEN=your_huggingface_api_key
- Create a
-
Run the Application:
node index.js
- The app will start on localhost:3000.
-
Text Summarization:
- Enter a large block of text (min. 200 characters).
- Click the "Summarize" button to generate a concise summary.
-
Text-to-Image Generation:
- Enter a text description of the image you want.
- Click the "Generate Image" button to see the AI-generated image.
-
User Interaction:
- Users interact with the web interface via the browser.
-
Client-Side Processing:
script.js
validates inputs and sends API requests to the server.
-
Server-Side Processing:
index.js
handles requests and routes them to the appropriate module (summarize.js
orconvert.js
).
-
API Interaction:
- Hugging Face APIs process the data and return results.
-
Result Display:
- Summaries and images are displayed in the browser.
- Hugging Face APIs: For providing powerful AI models for text summarization and image generation.
- Postman Academy: For student programs that inspired this project.