Python-GPT is an innovative project that integrates OpenAI's ChatGPT with a Python backend (FastAPI) and a React frontend. This application allows users to interact with ChatGPT in a user-friendly web interface, providing a seamless experience for querying and receiving responses from the AI model.
To get a local copy up and running, follow these simple steps.
Prerequisites
- Node.js and npm
npm install npm@latest -g
- Python 3.7+
- Clone the repo
- Install NPM packages for the React frontend
- Set up the Python virtual environment and install dependencies for the backend
- Enter your OpenAI API key in the .env file in the backend directory
Python-GPT can be used to interact with the ChatGPT model for various purposes, such as getting answers to questions, generating text based on prompts, or even having a casual conversation with the AI.
To start the backend server:
uvicorn main:app --reload
To run the frontend:
cd frontend npm run dev
In this demo, we posed a popular junior developer interview question to our ChatGPT-3 app: "Write a Python function to solve the 'Two Sum' problem."
The 'Two Sum' problem is a classic coding interview question that tests understanding of arrays and hash tables. The challenge is to find two numbers in an array that add up to a specific target number.
Here's the AI-generated solution to this problem:
The screenshot above shows the ChatGPT-3 app's response to the Two Sum problem, demonstrating its capability to assist with coding interview preparations.
Question: "Can you write a short story about a time-traveling detective?"
This prompt showcases ChatGPT-3's ability to create imaginative and narrative content.
The screenshot above displays the AI's creative storytelling skills.
Question: "Explain quantum computing in a way a 10-year-old would understand."
This demonstrates the AI's capability to simplify complex concepts for a younger audience.
Here, ChatGPT-3 breaks down the complexities of quantum computing into simpler terms.
Question: "Tell me a joke about artificial intelligence."
This prompt highlights the AI's lighter, more humorous side.
The AI's response to a humorous prompt, showcasing its wit.
Question: "What would be your advice for achieving happiness?"
This type of question can lead to interesting, thought-provoking responses from the AI.
ChatGPT-3's philosophical take on achieving happiness.
Question: "Describe what you think the world will look like in the year 2024."
This prompt showcases the AI's ability to generate speculative and futuristic ideas.
The AI's vision of the future, as depicted in its response.
- Implement user authentication for personalized experiences.
- Add more interactive features to the frontend.
- Integrate additional AI models for diverse functionalities.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Dalonte Griffin
Project Link: https://github.com/dalgriff/python-gpt
Acknowledgments
- OpenAI
- FastAPI
- React
- Vite