- Flask: A lightweight WSGI web application framework in Python. It is used to create the web server and handle HTTP requests.
- summarize.py: This module contains the
summarize_document
function, which is responsible for summarizing the uploaded document's content. You can enhance this function with more advanced summarization techniques as needed.
-
app.py:
- This is the main application file that sets up the Flask server and defines the routes for the application.
- It includes the following routes:
/
: The home route that renders the main interface for document upload./upload
: Handles file uploads, reads the content of the uploaded document, and generates a summary using thesummarize_document
function./ask
: Accepts user questions and provides answers based on the summary using theanswer_question
function.
-
summarize.py:
- Contains the
summarize_document
function, which currently provides a placeholder implementation for summarization. You can replace this with a more sophisticated summarization algorithm or library.
- Contains the
-
templates/index.html:
- The HTML template for the user interface. It includes a form for uploading documents, displays the generated summary, and allows users to ask questions based on the summary.
-
data.txt:
- A sample text file that can be used as input for the summarization function. It contains information about transformers in natural language processing.
-
Install Flask: Make sure you have Flask installed. You can install it using pip:
pip install Flask
-
Run the Application: Execute the following command in your terminal:
python app.py
-
Access the Application: Open your web browser and navigate to
http://127.0.0.1:5000/
to access the application. -
Upload a Document: Use the provided interface to upload a text document (e.g.,
data.txt
) and receive a summary. -
Ask Questions: After viewing the summary, you can ask questions related to the content, and the application will provide answers based on the implemented logic.
- Improve the summarization logic in
summarize.py
using advanced NLP techniques or libraries. - Enhance the Q&A functionality to provide more accurate and context-aware answers.
- Implement user authentication and session management for a more personalized experience.
This project is open-source and available for modification and distribution. Feel free to contribute or use it as a base for your own projects!