Spaces:
Sleeping
Sleeping
docker changes and readme file
Browse files- Dockerfile +4 -11
- README.md +50 -0
Dockerfile
CHANGED
@@ -16,15 +16,8 @@ RUN uv pip install --system -r requirements.txt
|
|
16 |
# Copy the application code
|
17 |
COPY . .
|
18 |
|
19 |
-
# Expose the port
|
20 |
-
EXPOSE
|
21 |
|
22 |
-
# Command to run the application
|
23 |
-
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "
|
24 |
-
|
25 |
-
# Add this line to your Dockerfile
|
26 |
-
RUN --mount=type=secret,id=openai_api_key \
|
27 |
-
cat /run/secrets/openai_api_key > /app/.env
|
28 |
-
|
29 |
-
ARG OPENAI_API_KEY
|
30 |
-
ENV OPENAI_API_KEY=$OPENAI_API_KEY
|
|
|
16 |
# Copy the application code
|
17 |
COPY . .
|
18 |
|
19 |
+
# Expose the port for Hugging Face Spaces (required)
|
20 |
+
EXPOSE 7860
|
21 |
|
22 |
+
# Command to run the application on Hugging Face's required port
|
23 |
+
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: OpenAI Chainlit Chat App
|
3 |
+
emoji: 💬
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: indigo
|
6 |
+
sdk: docker
|
7 |
+
sdk_version: "latest"
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
+
# OpenAI Chainlit Chat App
|
13 |
+
|
14 |
+
A streamlined, production-ready chat application powered by OpenAI's GPT models and built with Chainlit. This app provides an interactive chat experience with streaming responses, similar to ChatGPT.
|
15 |
+
|
16 |
+
## Features
|
17 |
+
|
18 |
+
- 💬 **Real-time streaming responses** - See AI replies as they're being generated
|
19 |
+
- 🧠 **Full conversation memory** - AI maintains context throughout the chat
|
20 |
+
- 🔄 **Async processing** for optimal performance
|
21 |
+
- 🛠️ **Error handling** for robust operation
|
22 |
+
|
23 |
+
## Technical Details
|
24 |
+
|
25 |
+
This application is built with:
|
26 |
+
- **Chainlit** - Provides the modern chat interface
|
27 |
+
- **OpenAI API** - Powers the AI responses using GPT models
|
28 |
+
- **Docker** - Containerizes the application for easy deployment
|
29 |
+
- **UV** - Efficient Python package management
|
30 |
+
|
31 |
+
## Local Development
|
32 |
+
|
33 |
+
To run this application locally:
|
34 |
+
|
35 |
+
1. Clone the repository:
|
36 |
+
2. Create a `.env` file with your OpenAI API key:
|
37 |
+
|
38 |
+
3. Build and run with Docker:
|
39 |
+
|
40 |
+
4. Access the application at http://localhost:7860
|
41 |
+
|
42 |
+
## Deployment
|
43 |
+
|
44 |
+
This app is configured for easy deployment on Hugging Face Spaces. The Docker container automatically runs on port 7860 as required by Hugging Face.
|
45 |
+
|
46 |
+
Remember to add your OpenAI API key as a secret in the Hugging Face Space settings.
|
47 |
+
|
48 |
+
## License
|
49 |
+
|
50 |
+
MIT
|