neuralleap's picture
Update README.md
7367c36 verified
---
title: GPT-Style Chat Assistant
emoji: 🤖
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: 1.42.2
app_file: app.py
pinned: false
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# GPT-Style Chat Assistant
A sophisticated Streamlit app that mimics the ChatGPT interface, using OpenAI's GPT models for advanced reasoning capabilities.
![Screenshot](https://i.ibb.co/bJfyXXn/gpt-style-assistant.png)
## Features
- **ChatGPT-like interface** with conversation sidebar
- **Multiple conversation management**:
- Create new chats
- Switch between conversations
- Delete old conversations
- **Model selection** - choose between different OpenAI models:
- Standard Models:
- GPT-3.5-Turbo (default)
- GPT-4
- GPT-3.5-Turbo-16k (for longer conversations)
- GPT-4-Turbo
- GPT-4o (latest GPT-4 Omni model)
- GPT-4o-Mini (efficient version of GPT-4o)
- Reasoning Models:
- o1-mini (Mini reasoning model)
- o1 (Standard reasoning model)
- o1-pro (Professional reasoning model)
- o3-mini (Advanced reasoning - Mini)
- o3-mini-high (Advanced reasoning - Enhanced)
- **Conversation history** preserved between sessions
- **Demo mode** that works without an API key
- **Responsive design** that adapts to different screen sizes
## Setup
1. Clone this repository
2. Install the required packages:
```
pip install -r requirements.txt
```
3. (Required for full functionality) Get an OpenAI API key:
- Create an account at [OpenAI](https://platform.openai.com/signup)
- Go to [API Keys](https://platform.openai.com/account/api-keys)
- Create a new API key
- Add it to a `.env` file in the root directory:
```
OPENAI_API_KEY=your_api_key_here
```
## Running Locally
Run the app with the following command:
```
streamlit run app.py
```
If you're having trouble with the `streamlit` command not being found, you can use the full path to the executable:
```
python -m streamlit run app.py
```
Or use the provided runner script:
```
python run_app.py
```
This will start the app and open it in your default browser.
## Demo Mode
The app includes a demo mode that works without an API key. In this mode:
- The assistant will provide pre-defined responses to common questions
- You'll see a text field in the sidebar where you can optionally enter an OpenAI API key
- For a full chatbot experience with reasoning capabilities, it's recommended to add your OpenAI API key
## Deploying to Hugging Face Spaces
1. Create a new Space on Hugging Face Spaces (https://huggingface.co/spaces)
2. Choose Streamlit as the SDK
3. Link your GitHub repository or upload the files directly
4. Add your OpenAI API key as a secret:
- Go to Settings > Repository Secrets
- Add a secret named `OPENAI_API_KEY` with your key
The app will automatically deploy and be available at your Hugging Face Spaces URL.
## About the Models
This app lets you select from multiple OpenAI models:
### Standard Models
- **GPT-3.5-Turbo**: Fast and cost-effective, suitable for most tasks
- **GPT-4**: More capable but slower and more expensive
- **GPT-3.5-Turbo-16k**: Supports longer conversations with extended context window
- **GPT-4-Turbo**: OpenAI's advanced model with larger context window
- **GPT-4o**: Latest GPT-4 Omni model, OpenAI's most advanced offering
- **GPT-4o-Mini**: More efficient version of GPT-4o with excellent capabilities
### Reasoning Models
OpenAI's specialized models for enhanced logical reasoning and problem-solving:
#### O1 Series
- **o1-mini**: Compact reasoning model for efficient problem-solving
- **o1**: Standard reasoning model with balanced capabilities
- **o1-pro**: Professional-grade reasoning with enhanced analytical abilities
#### O3 Series
- **o3-mini**: Advanced reasoning model optimized for efficiency
- **o3-mini-high**: Enhanced version with superior reasoning capabilities
All models are accessible using your OpenAI API key. Model availability depends on your API key permissions and subscription tier.
## Customization
You can easily customize the app by:
- Changing the model parameters in the `AVAILABLE_MODELS` dictionary
- Adjusting the styling in the CSS section
- Adding more features to the sidebar
- Creating additional response templates for the demo mode