Spaces:
Running
Running
DVampire
commited on
Commit
·
166ba0a
1
Parent(s):
21fd477
update readme
Browse files- DEPLOYMENT.md +0 -107
- README.md +107 -39
DEPLOYMENT.md
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
# PaperIndex Deployment Guide
|
2 |
-
|
3 |
-
## Hugging Face Spaces Deployment
|
4 |
-
|
5 |
-
### 1. Create Space
|
6 |
-
|
7 |
-
1. Visit [Hugging Face Spaces](https://huggingface.co/spaces)
|
8 |
-
2. Click "Create new Space"
|
9 |
-
3. Select "Docker" as SDK
|
10 |
-
4. Set Space name (e.g., "paperindex")
|
11 |
-
5. Choose "Public" or "Private"
|
12 |
-
|
13 |
-
### 2. Secure API Key Configuration
|
14 |
-
|
15 |
-
**Important: Never hardcode API keys in your code!**
|
16 |
-
|
17 |
-
#### Method 1: Use HF Spaces Secrets (Recommended)
|
18 |
-
|
19 |
-
1. On your Space page, click the "Settings" tab
|
20 |
-
2. Find "Repository secrets" in the left menu
|
21 |
-
3. Click "New secret"
|
22 |
-
4. Add the following secret:
|
23 |
-
- **Name**: `ANTHROPIC_API_KEY`
|
24 |
-
- **Value**: Your Anthropic API key
|
25 |
-
|
26 |
-
#### Method 2: Use Environment Variables (Local Development Only)
|
27 |
-
|
28 |
-
Create a `.env` file (do not commit to Git):
|
29 |
-
```bash
|
30 |
-
ANTHROPIC_API_KEY=your_api_key_here
|
31 |
-
```
|
32 |
-
|
33 |
-
### 3. Push Code
|
34 |
-
|
35 |
-
```bash
|
36 |
-
# Ensure database files use Git LFS
|
37 |
-
git lfs track "*.db"
|
38 |
-
git add .gitattributes
|
39 |
-
|
40 |
-
# Commit and push
|
41 |
-
git add .
|
42 |
-
git commit -m "Update deployment configuration"
|
43 |
-
git push origin main
|
44 |
-
```
|
45 |
-
|
46 |
-
### 4. Verify Deployment
|
47 |
-
|
48 |
-
1. Wait for HF Spaces to auto-build (usually 2-5 minutes)
|
49 |
-
2. Visit your Space URL: `https://huggingface.co/spaces/your-username/paperindex`
|
50 |
-
3. Check if the application is running properly
|
51 |
-
|
52 |
-
## Local Docker Deployment
|
53 |
-
|
54 |
-
### 1. Build Image
|
55 |
-
|
56 |
-
```bash
|
57 |
-
docker build -t paperindex .
|
58 |
-
```
|
59 |
-
|
60 |
-
### 2. Run Container
|
61 |
-
|
62 |
-
```bash
|
63 |
-
# Using environment variables
|
64 |
-
docker run -d -p 7860:7860 \
|
65 |
-
-e ANTHROPIC_API_KEY=your_api_key_here \
|
66 |
-
--name paperindex-app paperindex
|
67 |
-
|
68 |
-
# Or using .env file
|
69 |
-
docker run -d -p 7860:7860 \
|
70 |
-
--env-file .env \
|
71 |
-
--name paperindex-app paperindex
|
72 |
-
```
|
73 |
-
|
74 |
-
### 3. Access Application
|
75 |
-
|
76 |
-
Open browser and visit: `http://localhost:7860`
|
77 |
-
|
78 |
-
## Security Considerations
|
79 |
-
|
80 |
-
1. **Never** hardcode API keys in your code
|
81 |
-
2. **Never** commit `.env` files to Git repository
|
82 |
-
3. Use HF Spaces Secrets to store sensitive information
|
83 |
-
4. Regularly rotate API keys
|
84 |
-
5. Monitor API usage
|
85 |
-
|
86 |
-
## Troubleshooting
|
87 |
-
|
88 |
-
### Common Issues
|
89 |
-
|
90 |
-
1. **API Key Error**
|
91 |
-
- Check if HF Spaces Secrets are set correctly
|
92 |
-
- Verify API key is valid
|
93 |
-
|
94 |
-
2. **Build Failure**
|
95 |
-
- Check Dockerfile syntax
|
96 |
-
- View build logs
|
97 |
-
|
98 |
-
3. **Application Won't Start**
|
99 |
-
- Check port configuration
|
100 |
-
- View container logs: `docker logs paperindex-app`
|
101 |
-
|
102 |
-
### Getting Help
|
103 |
-
|
104 |
-
If you encounter issues:
|
105 |
-
1. Check HF Spaces build logs
|
106 |
-
2. View application logs
|
107 |
-
3. Report issues in GitHub Issues
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# PaperIndex
|
2 |
|
3 |
A beautiful web application for browsing and evaluating daily papers from Hugging Face, featuring a modern UI inspired by Hugging Face's design.
|
@@ -12,7 +23,7 @@ A beautiful web application for browsing and evaluating daily papers from Huggin
|
|
12 |
|
13 |
## Live Demo
|
14 |
|
15 |
-
🌐 **Hugging Face Spaces**: [PaperIndex Demo](https://huggingface.co/spaces/
|
16 |
|
17 |
## Local Development
|
18 |
|
@@ -45,59 +56,116 @@ python -m uvicorn server:app --reload --host 0.0.0.0 --port 8000
|
|
45 |
|
46 |
### Hugging Face Spaces (Recommended) - FREE!
|
47 |
|
48 |
-
**Hugging Face Spaces
|
49 |
-
- ✅
|
50 |
-
- ✅
|
51 |
-
- ✅
|
52 |
-
- ✅
|
53 |
-
- ✅
|
54 |
|
55 |
-
####
|
56 |
|
57 |
-
1.
|
58 |
-
-
|
59 |
-
-
|
60 |
-
-
|
61 |
-
-
|
62 |
-
-
|
63 |
|
64 |
-
2.
|
65 |
-
|
66 |
-
|
67 |
-
cp env.example .env
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
```
|
73 |
|
74 |
-
3.
|
75 |
```bash
|
76 |
-
#
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
```
|
79 |
|
80 |
-
4.
|
81 |
-
- Spaces
|
82 |
-
-
|
83 |
-
-
|
84 |
|
85 |
-
|
86 |
-
- 你的应用将在以下地址可用:`https://huggingface.co/spaces/your-username/paperindex`
|
87 |
-
- 部署完成后,你可以分享这个链接给任何人
|
88 |
|
89 |
-
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
### Alternative Deployment Options
|
97 |
|
98 |
-
- **Vercel**:
|
99 |
-
- **Railway**:
|
100 |
-
- **Render**:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
## Project Structure
|
103 |
|
|
|
1 |
+
---
|
2 |
+
title: PaperIndex
|
3 |
+
emoji: 📚
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: purple
|
6 |
+
sdk: docker
|
7 |
+
sdk_version: "latest"
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
# PaperIndex
|
13 |
|
14 |
A beautiful web application for browsing and evaluating daily papers from Hugging Face, featuring a modern UI inspired by Hugging Face's design.
|
|
|
23 |
|
24 |
## Live Demo
|
25 |
|
26 |
+
🌐 **Hugging Face Spaces**: [PaperIndex Demo](https://huggingface.co/spaces/zwt963/paperindex)
|
27 |
|
28 |
## Local Development
|
29 |
|
|
|
56 |
|
57 |
### Hugging Face Spaces (Recommended) - FREE!
|
58 |
|
59 |
+
**Hugging Face Spaces is completely free and includes:**
|
60 |
+
- ✅ Unlimited personal projects
|
61 |
+
- ✅ Automatic HTTPS
|
62 |
+
- ✅ Global CDN
|
63 |
+
- ✅ Automatic deployment
|
64 |
+
- ✅ Custom domain support
|
65 |
|
66 |
+
#### Deployment Steps:
|
67 |
|
68 |
+
1. **Create Space**:
|
69 |
+
- Visit [Hugging Face Spaces](https://huggingface.co/spaces)
|
70 |
+
- Click "Create new Space"
|
71 |
+
- Select "Docker" as SDK
|
72 |
+
- Set Space name (e.g., "paperindex")
|
73 |
+
- Choose "Public" or "Private"
|
74 |
|
75 |
+
2. **Secure API Key Configuration**:
|
76 |
+
|
77 |
+
**Important: Never hardcode API keys in your code!**
|
|
|
78 |
|
79 |
+
**Method 1: Use HF Spaces Secrets (Recommended)**
|
80 |
+
- On your Space page, click the "Settings" tab
|
81 |
+
- Find "Repository secrets" in the left menu
|
82 |
+
- Click "New secret"
|
83 |
+
- Add the following secret:
|
84 |
+
- **Name**: `ANTHROPIC_API_KEY`
|
85 |
+
- **Value**: Your Anthropic API key
|
86 |
+
|
87 |
+
**Method 2: Use Environment Variables (Local Development Only)**
|
88 |
+
Create a `.env` file (do not commit to Git):
|
89 |
+
```bash
|
90 |
+
ANTHROPIC_API_KEY=your_api_key_here
|
91 |
```
|
92 |
|
93 |
+
3. **Push Code**:
|
94 |
```bash
|
95 |
+
# Ensure database files use Git LFS
|
96 |
+
git lfs track "*.db"
|
97 |
+
git add .gitattributes
|
98 |
+
|
99 |
+
# Commit and push
|
100 |
+
git add .
|
101 |
+
git commit -m "Update deployment configuration"
|
102 |
+
git push origin main
|
103 |
```
|
104 |
|
105 |
+
4. **Verify Deployment**:
|
106 |
+
- Wait for HF Spaces to auto-build (usually 2-5 minutes)
|
107 |
+
- Visit your Space URL: `https://huggingface.co/spaces/your-username/paperindex`
|
108 |
+
- Check if the application is running properly
|
109 |
|
110 |
+
### Local Docker Deployment
|
|
|
|
|
111 |
|
112 |
+
1. **Build Image**:
|
113 |
+
```bash
|
114 |
+
docker build -t paperindex .
|
115 |
+
```
|
116 |
|
117 |
+
2. **Run Container**:
|
118 |
+
```bash
|
119 |
+
# Using environment variables
|
120 |
+
docker run -d -p 7860:7860 \
|
121 |
+
-e ANTHROPIC_API_KEY=your_api_key_here \
|
122 |
+
--name paperindex-app paperindex
|
123 |
+
|
124 |
+
# Or using .env file
|
125 |
+
docker run -d -p 7860:7860 \
|
126 |
+
--env-file .env \
|
127 |
+
--name paperindex-app paperindex
|
128 |
+
```
|
129 |
+
|
130 |
+
3. **Access Application**:
|
131 |
+
Open browser and visit: `http://localhost:7860`
|
132 |
|
133 |
### Alternative Deployment Options
|
134 |
|
135 |
+
- **Vercel**: Free plan, unlimited personal projects
|
136 |
+
- **Railway**: Simple deployment, $5/month free tier
|
137 |
+
- **Render**: Free tier available
|
138 |
+
|
139 |
+
## Security Considerations
|
140 |
+
|
141 |
+
1. **Never** hardcode API keys in your code
|
142 |
+
2. **Never** commit `.env` files to Git repository
|
143 |
+
3. Use HF Spaces Secrets to store sensitive information
|
144 |
+
4. Regularly rotate API keys
|
145 |
+
5. Monitor API usage
|
146 |
+
|
147 |
+
## Troubleshooting
|
148 |
+
|
149 |
+
### Common Issues
|
150 |
+
|
151 |
+
1. **API Key Error**
|
152 |
+
- Check if HF Spaces Secrets are set correctly
|
153 |
+
- Verify API key is valid
|
154 |
+
|
155 |
+
2. **Build Failure**
|
156 |
+
- Check Dockerfile syntax
|
157 |
+
- View build logs
|
158 |
+
|
159 |
+
3. **Application Won't Start**
|
160 |
+
- Check port configuration
|
161 |
+
- View container logs: `docker logs paperindex-app`
|
162 |
+
|
163 |
+
### Getting Help
|
164 |
+
|
165 |
+
If you encounter issues:
|
166 |
+
1. Check HF Spaces build logs
|
167 |
+
2. View application logs
|
168 |
+
3. Report issues in GitHub Issues
|
169 |
|
170 |
## Project Structure
|
171 |
|