Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -12,3 +12,92 @@ short_description: 'AI Blog generator with Openai and Groq support. '
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
# Deploying Your LangGraph Blog Generator
|
| 19 |
+
|
| 20 |
+
This guide will walk you through setting up and deploying your LangGraph blog generator application.
|
| 21 |
+
|
| 22 |
+
## Prerequisites
|
| 23 |
+
|
| 24 |
+
- Python 3.9+ installed
|
| 25 |
+
- pip (Python package installer)
|
| 26 |
+
- Git (optional, for version control)
|
| 27 |
+
|
| 28 |
+
## Step 1: Set Up Your Environment
|
| 29 |
+
|
| 30 |
+
First, create a project directory and set up a virtual environment:
|
| 31 |
+
|
| 32 |
+
```bash
|
| 33 |
+
# Create project directory
|
| 34 |
+
mkdir langgraph-blog-generator
|
| 35 |
+
cd langgraph-blog-generator
|
| 36 |
+
|
| 37 |
+
# Create and activate virtual environment
|
| 38 |
+
python -m venv venv
|
| 39 |
+
|
| 40 |
+
# On Windows
|
| 41 |
+
venv\Scripts\activate
|
| 42 |
+
|
| 43 |
+
# On macOS/Linux
|
| 44 |
+
source venv/bin/activate
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Step 2: Install Required Packages
|
| 48 |
+
|
| 49 |
+
Create a `requirements.txt` file with the following content:
|
| 50 |
+
|
| 51 |
+
```
|
| 52 |
+
langchain==0.1.4
|
| 53 |
+
langchain-openai==0.0.5
|
| 54 |
+
langgraph==0.0.20
|
| 55 |
+
pydantic==2.5.2
|
| 56 |
+
streamlit==1.28.0
|
| 57 |
+
python-dotenv==1.0.0
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
Install the packages:
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
pip install -r requirements.txt
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Step 3: Configure Environment Variables
|
| 67 |
+
|
| 68 |
+
Create a `.env` file in your project directory:
|
| 69 |
+
|
| 70 |
+
```
|
| 71 |
+
OPENAI_API_KEY=your_openai_api_key_here
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
Replace `your_openai_api_key_here` with your actual OpenAI API key.
|
| 75 |
+
|
| 76 |
+
## Step 4: Create the Application File
|
| 77 |
+
|
| 78 |
+
Create a file named `app.py` and paste the code from the LangGraph Blog Generator code artifact.
|
| 79 |
+
|
| 80 |
+
## Step 5: Run Locally
|
| 81 |
+
|
| 82 |
+
Test the application locally:
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
streamlit run app.py
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
Your browser should open automatically to `http://localhost:8501` with the blog generator app running.
|
| 89 |
+
|
| 90 |
+
## Step 6: Deployment
|
| 91 |
+
|
| 92 |
+
1. Create a free account on hugginface
|
| 93 |
+
2. Add requirements.txt
|
| 94 |
+
3. Add the files to the spaces
|
| 95 |
+
4. Build the dependencies
|
| 96 |
+
5. Deploy the app
|
| 97 |
+
|
| 98 |
+
Alternatively, you can deploy to other platforms:
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
|