In this repository, we generate both textual summaries and image descriptions for written texts.
The application is divided into Frontend and Backend. The backend is a locally running python server which is communicating with the frontend svelte based web application.
In the backend folder, we generate the text summaries and images.
First generate text summaries based on json/epub content:
python backend/book_summarizer.py --input_file "data/alice.json"
Then generate image representations of the text.
python backend/generator.py --input_file "data/alice_summarized.json" --output_dir "results"
Images are generated using a stable diffusion text to image model.
For now, the frontend only displays different levels of text summaries.
Images are only placeholders as of now.
Install Python and Node.js on your computer.
Clone the Project from GitHub and open the book_summary folder.
As an example Visual Studio Code is used here. Check that you have the Python extension installed.
- Install miniconda as Python environment.
- Press STRG + SHIFT + P and search for Python: Create Environment > Conda.
Here you can find more information regarding environments.
To select an interpreter, press STRG + SHIFT + P and search for Python: Select Interpreter.
- Open the terminal in VS Code and start a new command prompt.
cd backend
to change the directory to the backend folder.pip install -r requirements.txt
to install the requirements.- Optionally create a
.flaskenv
file with your HUGGINGFACE_TOKEN, see Huggingface security-tokens.
HUGGINGFACE_TOKEN="hf_YOUR_TOKEN_HERE"
Specifying the token will allow you to use the HuggingFace inference servers, which potentially are faster than your computer. python server.py
to start the backend server.
- After the backend server is up and running, open a new command prompt.
cd frontend
to go into the frontend folder.yarn install
to install npm.- Create a .env file to establish the backend URL for the frontend. By default, it should look like this:
PUBLIC_BACKEND_URL="http://127.0.0.1:5000"
yarn dev
to start the frontend.
Now the application should be running at http://localhost:5173/
.