Spaces:
Sleeping
Sleeping
DVampire
commited on
Commit
Β·
950ac53
1
Parent(s):
166ba0a
update
Browse files
README.md
CHANGED
|
@@ -21,171 +21,22 @@ A beautiful web application for browsing and evaluating daily papers from Huggin
|
|
| 21 |
- π **Smart Caching**: Intelligent caching system for better performance
|
| 22 |
- π± **Responsive**: Works perfectly on desktop and mobile devices
|
| 23 |
|
| 24 |
-
##
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
|
| 28 |
## Local Development
|
| 29 |
|
| 30 |
-
### Prerequisites
|
| 31 |
-
|
| 32 |
-
- Python 3.8+
|
| 33 |
-
- pip
|
| 34 |
-
|
| 35 |
-
### Installation
|
| 36 |
-
|
| 37 |
-
1. Clone the repository:
|
| 38 |
-
```bash
|
| 39 |
-
git clone https://github.com/your-username/PaperIndex.git
|
| 40 |
-
cd PaperIndex
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
2. Install dependencies:
|
| 44 |
```bash
|
|
|
|
| 45 |
pip install -r requirements.txt
|
| 46 |
-
```
|
| 47 |
|
| 48 |
-
|
| 49 |
-
```bash
|
| 50 |
python -m uvicorn server:app --reload --host 0.0.0.0 --port 8000
|
| 51 |
```
|
| 52 |
|
| 53 |
-
4. Open your browser and visit: `http://localhost:8000`
|
| 54 |
-
|
| 55 |
-
## Deployment
|
| 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 |
-
|
| 172 |
-
```
|
| 173 |
-
PaperIndex/
|
| 174 |
-
βββ frontend/ # Static frontend files
|
| 175 |
-
β βββ index.html # Main page
|
| 176 |
-
β βββ paper.html # Paper evaluation page
|
| 177 |
-
β βββ main.js # Main page JavaScript
|
| 178 |
-
β βββ paper.js # Evaluation page JavaScript
|
| 179 |
-
β βββ styles.css # Shared styles
|
| 180 |
-
βββ agents/ # AI evaluation agents
|
| 181 |
-
βββ workdir/ # Evaluation data storage
|
| 182 |
-
βββ data/ # Data files
|
| 183 |
-
βββ server.py # FastAPI backend
|
| 184 |
-
βββ app.py # Hugging Face Spaces entry point
|
| 185 |
-
βββ requirements.txt # Python dependencies
|
| 186 |
-
βββ README.md # This file
|
| 187 |
-
```
|
| 188 |
-
|
| 189 |
## API Endpoints
|
| 190 |
|
| 191 |
- `GET /` - Main page
|
|
@@ -195,20 +46,14 @@ PaperIndex/
|
|
| 195 |
- `GET /api/cache/status` - Get cache status
|
| 196 |
- `POST /api/cache/clear` - Clear cache
|
| 197 |
|
| 198 |
-
##
|
| 199 |
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
4. Submit a pull request
|
| 204 |
|
| 205 |
## License
|
| 206 |
|
| 207 |
-
MIT License
|
| 208 |
-
|
| 209 |
-
## Acknowledgments
|
| 210 |
-
|
| 211 |
-
- Inspired by Hugging Face's beautiful paper browsing interface
|
| 212 |
-
- Built with FastAPI and modern web technologies
|
| 213 |
|
| 214 |
|
|
|
|
| 21 |
- π **Smart Caching**: Intelligent caching system for better performance
|
| 22 |
- π± **Responsive**: Works perfectly on desktop and mobile devices
|
| 23 |
|
| 24 |
+
## Setup
|
| 25 |
|
| 26 |
+
1. **Configure API Key**: Add `ANTHROPIC_API_KEY` to your Space secrets
|
| 27 |
+
2. **Wait for Build**: The app will automatically build and deploy
|
| 28 |
+
3. **Access**: Your app will be available at the Space URL
|
| 29 |
|
| 30 |
## Local Development
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
```bash
|
| 33 |
+
# Install dependencies
|
| 34 |
pip install -r requirements.txt
|
|
|
|
| 35 |
|
| 36 |
+
# Run development server
|
|
|
|
| 37 |
python -m uvicorn server:app --reload --host 0.0.0.0 --port 8000
|
| 38 |
```
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
## API Endpoints
|
| 41 |
|
| 42 |
- `GET /` - Main page
|
|
|
|
| 46 |
- `GET /api/cache/status` - Get cache status
|
| 47 |
- `POST /api/cache/clear` - Clear cache
|
| 48 |
|
| 49 |
+
## Security
|
| 50 |
|
| 51 |
+
- API keys are stored securely in HF Spaces secrets
|
| 52 |
+
- Never hardcode sensitive information in your code
|
| 53 |
+
- Use environment variables for local development
|
|
|
|
| 54 |
|
| 55 |
## License
|
| 56 |
|
| 57 |
+
MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
|