Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,10 @@ import requests
|
|
| 3 |
from datetime import datetime, timezone, timedelta
|
| 4 |
import os
|
| 5 |
import google.generativeai as genai
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def get_all_commits_in_range(owner, repo_name, start_date, end_date, token):
|
| 8 |
"""
|
|
@@ -228,7 +232,7 @@ with gr.Blocks(title="Git Commit Story Analyzer", theme=gr.themes.Soft()) as app
|
|
| 228 |
|
| 229 |
analyze_btn.click(
|
| 230 |
fn=analyze_commits,
|
| 231 |
-
inputs=[repo_input, start_date_input, end_date_input
|
| 232 |
outputs=output
|
| 233 |
)
|
| 234 |
|
|
@@ -238,8 +242,14 @@ with gr.Blocks(title="Git Commit Story Analyzer", theme=gr.themes.Soft()) as app
|
|
| 238 |
|
| 239 |
1. **Enter Repository**: Provide the GitHub repository (e.g., `torvalds/linux` or full URL)
|
| 240 |
2. **Select Date Range**: Choose single day or date range for analysis
|
| 241 |
-
3. **
|
| 242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
|
| 244 |
**Note**: The tool fetches commits from all branches and removes duplicates automatically.
|
| 245 |
""")
|
|
|
|
| 3 |
from datetime import datetime, timezone, timedelta
|
| 4 |
import os
|
| 5 |
import google.generativeai as genai
|
| 6 |
+
from dotenv import load_dotenv
|
| 7 |
+
|
| 8 |
+
# Load environment variables from .env file
|
| 9 |
+
load_dotenv()
|
| 10 |
|
| 11 |
def get_all_commits_in_range(owner, repo_name, start_date, end_date, token):
|
| 12 |
"""
|
|
|
|
| 232 |
|
| 233 |
analyze_btn.click(
|
| 234 |
fn=analyze_commits,
|
| 235 |
+
inputs=[repo_input, start_date_input, end_date_input],
|
| 236 |
outputs=output
|
| 237 |
)
|
| 238 |
|
|
|
|
| 242 |
|
| 243 |
1. **Enter Repository**: Provide the GitHub repository (e.g., `torvalds/linux` or full URL)
|
| 244 |
2. **Select Date Range**: Choose single day or date range for analysis
|
| 245 |
+
3. **Analyze**: Click the button to generate your commit story
|
| 246 |
+
|
| 247 |
+
### 🔧 Setup Instructions for Hugging Face Spaces
|
| 248 |
+
|
| 249 |
+
Before deploying, add these secrets in your Space settings:
|
| 250 |
+
1. Go to Settings → Repository secrets
|
| 251 |
+
2. Add `GITHUB_TOKEN` - Get from GitHub: Settings → Developer settings → Personal access tokens
|
| 252 |
+
3. Add `GEMINI_API_KEY` - Get from [Google AI Studio](https://makersuite.google.com/app/apikey)
|
| 253 |
|
| 254 |
**Note**: The tool fetches commits from all branches and removes duplicates automatically.
|
| 255 |
""")
|