A gpt for homework. The user can upload images & pdf.
This project is a Flask-based chat application that integrates with a JavaScript script for various functionalities. The Flask application serves as a chat interface, allowing users to interact with the chat, upload files, and receive responses from an AI model. The JavaScript script handles client-side actions such as image capturing, message display, and file uploads.
Before you begin, ensure you have the following prerequisites:
- Python 3.x
- pip
- Virtual environment (recommended)
- A web browser with JavaScript support
- Access to the Flask Chat Application
-
Clone the Flask Chat Application repository to your local machine:
git clone https://github.com/sebastianaldrin/super-geni.git cd your-repo
-
Create a virtual environment (optional but recommended):
python -m venv venv
-
Activate the virtual environment:
-
On Windows:
venv\Scripts\activate
-
On macOS and Linux:
source venv/bin/activate
-
-
Install the required Python packages:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.env
file in the project directory. - Add the following environment variables with your API keys and configuration:
FLASK_SECRET_KEY=your_secret_key_here OPENAI_API_KEY= 'your api-key' PORT=5000
- Create a
-
Run the Flask application:
python app.py
-
Access the chat interface by visiting
http://localhost:5000
in your web browser. -
Interact with the chat interface, send messages, and upload images or PDF files for text extraction.
-
The application integrates with the OpenAI API for conversation responses.
-
scrollToBottom()
: Scrolls the chatbox to the bottom. -
captureImage()
: Captures an image from the video stream. -
accessCamera()
: Creates a camera overlay with a "Coming soon" message and close button. -
startVideo()
: Starts the video stream. -
stopVideo()
: Stops the video stream. -
showVideo()
: Makes the video element visible. -
hideVideo()
: Hides the video element. -
appendMessage(message)
: Appends a message to the chatbox. -
sendUserMessage(messageContent)
: Sends a user message to the server. -
handleFileUpload()
: Handles file uploads asynchronously. -
resetChat()
: Resets the chat.
- Split the code, make it easier to read.
- Clean up the code.
- Websockets are not working correctly, the page refreshes when sending messages.
- The camera button is supposed to open the camera where the user can take a picture of the homework and then upload it, flask extracts the text and sends it to chatgpt.
- Switch from standard chatgpt to custom chatgpt assistant. " https://platform.openai.com/docs/assistants/overview "
Contributions to this project are welcome! If you have improvements, bug fixes, or new features to contribute to either the Flask App or the JavaScript script, please feel free to contribute by opening a pull request or submitting an issue.
- Sebastian Aldrin, Sweden
This project is provided under the GPL-3 License. See the LICENSE file for details.