Skip to content

Latest commit

 

History

405 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT Web Application — Modern Responses API + Legacy Experiments

GitHub stars GitHub forks Python modernization

A runnable Streamlit chat application using the modern OpenAI Responses API, while preserving the project's original Colab/Kaggle/Gradio notebooks as historical learning material.

Modern 2026 application

ChatGPT_Web_Application.py is now the supported application entrypoint.

The app uses:

  • the official OpenAI Python SDK
  • client.responses.create(...)
  • response.output_text
  • OPENAI_API_KEY from the environment
  • previous_response_id for multi-turn conversation state
  • Streamlit chat components
  • gpt-5.5 as the default model, overridable with OPENAI_MODEL or the sidebar

Setup

git clone https://github.com/AmirMotefaker/ChatGPT-Web-Application.git
cd ChatGPT-Web-Application
python -m venv .venv

Activate it:

# Windows PowerShell
.venv\Scripts\Activate.ps1
# macOS / Linux
source .venv/bin/activate

Install dependencies:

python -m pip install -r requirements.txt

Set the API key locally:

$env:OPENAI_API_KEY = "your-key-here"

or:

export OPENAI_API_KEY="your-key-here"

Run the app:

streamlit run ChatGPT_Web_Application.py

The sidebar lets you change the model and clear the current conversation. Changing the model resets the stored response chain to avoid mixing conversation state across models.

Architecture

Streamlit UI
    |
    v
ChatGPT_Web_Application.py
    |
    v
openai_service.py
    |
    v
OpenAI Responses API

openai_service.py isolates the API call from the UI and makes the Responses API contract testable without making paid network requests.

Historical notebooks

These files are preserved as an archive of the original project:

File Status
ChatGPT_Web_Application_colab.ipynb Legacy educational notebook
ChatGPT_Web_Application_using_Streamlit_colab.ipynb Legacy Streamlit/Colab notebook
ChatGPT_Web_Application_using_Gradio_colab.ipynb Legacy Gradio/Colab notebook
chatgpt-web-application-kaggle.ipynb Legacy Kaggle notebook
chatgpt-web-application-using-gradio.ipynb Legacy Gradio notebook

Important

The historical notebooks can contain old model names or deprecated OpenAI API patterns. The root Streamlit application is the modern supported path.

Validation

python -m unittest discover -s tests -v
python -m compileall -q .

GitHub Actions validates the modernization on Python 3.10 and 3.12 and performs offline unit tests, syntax compilation, secret-pattern scanning, and a guard against legacy API usage in modern entrypoints.

Security

  • Never hard-code an API key.
  • Use OPENAI_API_KEY in your environment or secret manager.
  • .env and Streamlit secret files are ignored.
  • CI does not make live OpenAI API requests.

Support the project

If the modern Streamlit example or legacy learning material helps you, consider giving the repository a ⭐.

Author

Amir MotefakerGitHub · Website

About

Build a ChatGPT-style web app in Python with Streamlit, Gradio, OpenAI APIs, and Jupyter-based examples.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages