Flask app that uses the OpenAI API to generate quick summaries of academic articles using GPT without manually prompting ChatGPT repeatedly. By default, this app uses the GPT-4o-mini LLM, which is very cheap to use (probably less than $0.01 per summary).
To see how the app works, check out our demo video:
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Set up the settings.yaml file:
- Create a file named
settings.yaml
in the root directory of the project. - Add the following content to the file:
# Upload configuration UPLOAD_FOLDER: 'uploads' # OpenAI configuration OPENAI_API_KEY: # Your OpenAI API key goes here, e.g. 'sk-proj-uidazio...'
- Replace the placeholder text with your actual OpenAI API key, which you can find here. Once you account is set up you can add credit here.
- Create a file named
-
Run the app:
python app.py
The app should now be running on http://localhost
.
Load http://localhost
in a browser and then drag and drop a file into the Dropzone to get started.
Before you can use the application, you need to add the first user to the database. This user will have admin privileges. Follow these steps:
-
Ensure your application is set up and the database file (
users.db
) has been created. -
Open a Python interactive shell in your project directory:
python
-
In the Python shell, enter the following commands:
import sqlite3 from werkzeug.security import generate_password_hash # Connect to the database conn = sqlite3.connect('users.db') c = conn.cursor() # Insert the first admin user username = 'admin' # Change this to your desired admin username password = 'your_secure_password' # Change this to a secure password hashed_password = generate_password_hash(password) is_admin = True c.execute("INSERT INTO users (username, password, is_admin) VALUES (?, ?, ?)", (username, hashed_password, is_admin)) # Commit the changes and close the connection conn.commit() conn.close() print("Admin user created successfully.")
-
Exit the Python shell:
exit()
Now you have created the first admin user. You can use these credentials to log in to the application and access the admin panel to manage other users.
Remember to change the default admin username and password to something secure. Never share your admin credentials or commit them to version control.
- Start the Flask application by running
python main.py
. - Open a web browser and navigate to
http://localhost:80
(or the appropriate address if you've configured it differently). - Log in using the admin credentials you created.
- You can now use the application to summarize articles and manage users through the admin panel.