Update README.MD
Browse files
README.md
CHANGED
@@ -1,82 +1,95 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
```
|
44 |
-
|
45 |
-
```
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
The
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
-
|
81 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
- Creating additional response templates for the demo mode
|
|
|
1 |
+
---
|
2 |
+
title: GPT-Style Chat Assistant
|
3 |
+
emoji: 🤖
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: green
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.24.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
13 |
+
|
14 |
+
# GPT-Style Chat Assistant
|
15 |
+
|
16 |
+
A sophisticated Streamlit app that mimics the ChatGPT interface, using OpenAI's GPT models for advanced reasoning capabilities.
|
17 |
+
|
18 |
+

|
19 |
+
|
20 |
+
## Features
|
21 |
+
|
22 |
+
- **ChatGPT-like interface** with conversation sidebar
|
23 |
+
- **Multiple conversation management**:
|
24 |
+
- Create new chats
|
25 |
+
- Switch between conversations
|
26 |
+
- Delete old conversations
|
27 |
+
- **Conversation history** preserved between sessions
|
28 |
+
- **Demo mode** that works without an API key
|
29 |
+
- **Responsive design** that adapts to different screen sizes
|
30 |
+
|
31 |
+
## Setup
|
32 |
+
|
33 |
+
1. Clone this repository
|
34 |
+
2. Install the required packages:
|
35 |
+
```
|
36 |
+
pip install -r requirements.txt
|
37 |
+
```
|
38 |
+
3. (Required for full functionality) Get an OpenAI API key:
|
39 |
+
- Create an account at [OpenAI](https://platform.openai.com/signup)
|
40 |
+
- Go to [API Keys](https://platform.openai.com/account/api-keys)
|
41 |
+
- Create a new API key
|
42 |
+
- Add it to a `.env` file in the root directory:
|
43 |
+
```
|
44 |
+
OPENAI_API_KEY=your_api_key_here
|
45 |
+
```
|
46 |
+
|
47 |
+
## Running Locally
|
48 |
+
|
49 |
+
Run the app with the following command:
|
50 |
+
|
51 |
+
```
|
52 |
+
streamlit run app.py
|
53 |
+
```
|
54 |
+
|
55 |
+
If you're having trouble with the `streamlit` command not being found, you can use the full path to the executable:
|
56 |
+
```
|
57 |
+
python -m streamlit run app.py
|
58 |
+
```
|
59 |
+
|
60 |
+
Or use the provided runner script:
|
61 |
+
```
|
62 |
+
python run_app.py
|
63 |
+
```
|
64 |
+
|
65 |
+
This will start the app and open it in your default browser.
|
66 |
+
|
67 |
+
## Demo Mode
|
68 |
+
|
69 |
+
The app includes a demo mode that works without an API key. In this mode:
|
70 |
+
- The assistant will provide pre-defined responses to common questions
|
71 |
+
- You'll see a text field in the sidebar where you can optionally enter an OpenAI API key
|
72 |
+
- For a full chatbot experience with reasoning capabilities, it's recommended to add your OpenAI API key
|
73 |
+
|
74 |
+
## Deploying to Hugging Face Spaces
|
75 |
+
|
76 |
+
1. Create a new Space on Hugging Face Spaces (https://huggingface.co/spaces)
|
77 |
+
2. Choose Streamlit as the SDK
|
78 |
+
3. Link your GitHub repository or upload the files directly
|
79 |
+
4. Add your OpenAI API key as a secret:
|
80 |
+
- Go to Settings > Repository Secrets
|
81 |
+
- Add a secret named `OPENAI_API_KEY` with your key
|
82 |
+
|
83 |
+
The app will automatically deploy and be available at your Hugging Face Spaces URL.
|
84 |
+
|
85 |
+
## About the Model
|
86 |
+
|
87 |
+
This app uses OpenAI's GPT-3.5-Turbo model, which is a powerful language model with excellent reasoning capabilities. You'll need an OpenAI API key to access this model.
|
88 |
+
|
89 |
+
## Customization
|
90 |
+
|
91 |
+
You can easily customize the app by:
|
92 |
+
- Changing the model in the `get_ai_response` function
|
93 |
+
- Adjusting the styling in the CSS section
|
94 |
+
- Adding more features to the sidebar
|
95 |
- Creating additional response templates for the demo mode
|