“I can calculate the motion of heavenly bodies, but not the madness of people.”
Engage in a conversation with a digital persona of Sir Isaac Newton through an interactive web interface. This AI-powered assistant, built with Python 3.13, LangChain, and Gradio, emulates the intellect and historical voice of one of history's greatest scientific minds. Ask about gravity, calculus, optics, or even his alchemical pursuits!
A glimpse of the web interface you will be running locally.

- Interactive Web UI: A clean and simple chat interface powered by Gradio, allowing for easy interaction without the command line.
- Authentic Persona: The AI's personality is carefully prompted and managed using LangChain to provide responses befitting Isaac Newton's formal, 17th-century tone.
- Conversation Memory: Remembers the context of the current conversation for a more natural and coherent dialogue.
-
Scientific Expertise: Capable of discussing complex topics in physics and mathematics, complete with LaTeX support for formulas like
$F=ma$ . - Modern Tech Stack: Utilizes the latest in Python and AI application development tools for a robust and maintainable codebase.
- Core Language: Python 3.13
- AI Orchestration: LangChain
- Web Interface: Gradio
- AI/LLM: Backend agnostic (designed for use with any major LLM provider like OpenAI, Google, etc.)
- Environment Variables:
python-dotenv
To get the AI running on your local machine, please follow the steps below.
- Python 3.13 or newer.
- An API Key from an LLM provider (e.g., OpenAI, Google AI Studio, Anthropic).
-
Clone the Repository:
git clone https://github.com/SubhashishTheCoder//Chat-with-Newton.git cd Chat-with-Newton -
Create and Activate a Virtual Environment:
- On macOS/Linux:
python3 -m venv venv source venv/bin/activate - On Windows:
python -m venv venv .\venv\Scripts\activate
- On macOS/Linux:
-
Install Dependencies: The necessary packages are listed in
requirements.txt. Install them with pip:pip install -r requirements.txt
-
Configure Environment Variables: You must provide your API key for the language model to work.
- Create a new file named
.envin the root directory of the project. - Add your API key to the
.envfile. The variable name may depend on your provider (e.g.,OPENAI_API_KEY).# Example for OpenAI OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- Create a new file named
With the setup complete, you can now launch the web application.
-
Run the application from your terminal:
python app.py
(Note: If your main script is named differently, use that name instead of
app.py.) -
Open the Interface: The terminal will output a local URL, typically
http://127.0.0.1:7860. Open this link in your web browser. -
Start Chatting: You can now type your questions into the chat interface and receive responses from Sir Isaac Newton.