Spaces:
No application file
No application file
Liss, Alex (NYC-HUG)
commited on
Commit
Β·
52fac6f
1
Parent(s):
b11c09e
updated documentation
Browse files- README.md +21 -0
- docs/requirements.md +3 -2
- upload_secrets.py +48 -0
README.md
CHANGED
@@ -111,3 +111,24 @@ Before pushing to a public repository:
|
|
111 |
- "Show me the recap of the 49ers vs. Vikings game"
|
112 |
|
113 |
The application will use the appropriate tools to answer your questions based on the data in the Neo4j database.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
- "Show me the recap of the 49ers vs. Vikings game"
|
112 |
|
113 |
The application will use the appropriate tools to answer your questions based on the data in the Neo4j database.
|
114 |
+
|
115 |
+
## Deployment
|
116 |
+
|
117 |
+
This application has been deployed to HuggingFace Spaces and is publicly available at:
|
118 |
+
[https://huggingface.co/spaces/aliss77777/ifx-sandbox](https://huggingface.co/spaces/aliss77777/ifx-sandbox)
|
119 |
+
|
120 |
+
### Deployment Steps
|
121 |
+
1. Used Gradio's built-in deployment feature: `gradio deploy --app-file gradio_app.py --title "49ers FanAI Hub"`
|
122 |
+
2. Uploaded environment variables securely as Secrets in the HuggingFace Space
|
123 |
+
3. Verified all API connections and data access on the deployed version
|
124 |
+
|
125 |
+
The deployment process automatically handles:
|
126 |
+
- Code upload to HuggingFace Spaces
|
127 |
+
- Installing dependencies from requirements.txt
|
128 |
+
- Building and serving the Gradio application
|
129 |
+
|
130 |
+
### Final Checks
|
131 |
+
- Verified UI rendering and responsiveness
|
132 |
+
- Confirmed data accuracy and Neo4j connection
|
133 |
+
- Tested all features: chat, graph queries, and game recap functionality
|
134 |
+
- Documented any deployment-specific issues or limitations
|
docs/requirements.md
CHANGED
@@ -431,11 +431,12 @@ Implement the Game Search feature (Feature 1 from Feature Overview) with focus o
|
|
431 |
- Verify data flow to Gradio component
|
432 |
- **Implementation:** Created game_recap.py with Cypher generation templates and GraphCypherQAChain for retrieving game data. Implemented natural language understanding for game identification through date formats, team names, and relative references. Successfully established data flow from Neo4j to the Gradio component with proper structured data handling.
|
433 |
|
434 |
-
8. **Final Deployment
|
435 |
-
- Deploy to
|
436 |
- Perform final UI checks
|
437 |
- Verify data accuracy
|
438 |
- Document any issues
|
|
|
439 |
|
440 |
#### Failure Conditions
|
441 |
- Halt process if any step fails after 3 attempts
|
|
|
431 |
- Verify data flow to Gradio component
|
432 |
- **Implementation:** Created game_recap.py with Cypher generation templates and GraphCypherQAChain for retrieving game data. Implemented natural language understanding for game identification through date formats, team names, and relative references. Successfully established data flow from Neo4j to the Gradio component with proper structured data handling.
|
433 |
|
434 |
+
8. **Final Deployment β
**
|
435 |
+
- Deploy to HuggingFace Spaces: https://huggingface.co/spaces/aliss77777/ifx-sandbox
|
436 |
- Perform final UI checks
|
437 |
- Verify data accuracy
|
438 |
- Document any issues
|
439 |
+
- **Implementation:** Successfully deployed to HuggingFace Spaces using Gradio's built-in deployment feature. Secured environment variables as HuggingFace Secrets. Verified all connections, data accuracy, and UI functionality on the deployed version.
|
440 |
|
441 |
#### Failure Conditions
|
442 |
- Halt process if any step fails after 3 attempts
|
upload_secrets.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
import os
|
3 |
+
import re
|
4 |
+
from huggingface_hub import HfApi
|
5 |
+
|
6 |
+
# Initialize the Hugging Face API
|
7 |
+
api = HfApi()
|
8 |
+
|
9 |
+
# Define the repository (Space) name
|
10 |
+
repo_id = "aliss77777/ifx-sandbox"
|
11 |
+
|
12 |
+
# Function to parse .env file
|
13 |
+
def parse_env_file(file_path):
|
14 |
+
secrets = {}
|
15 |
+
with open(file_path, 'r') as file:
|
16 |
+
for line in file:
|
17 |
+
line = line.strip()
|
18 |
+
# Skip empty lines and comments
|
19 |
+
if not line or line.startswith('#'):
|
20 |
+
continue
|
21 |
+
|
22 |
+
# Parse key-value pairs
|
23 |
+
match = re.match(r'^([A-Za-z0-9_]+)\s*=\s*["\'](.*)["\']$', line)
|
24 |
+
if match:
|
25 |
+
key, value = match.groups()
|
26 |
+
secrets[key] = value
|
27 |
+
else:
|
28 |
+
# Try without quotes
|
29 |
+
match = re.match(r'^([A-Za-z0-9_]+)\s*=\s*(.*)$', line)
|
30 |
+
if match:
|
31 |
+
key, value = match.groups()
|
32 |
+
secrets[key] = value
|
33 |
+
|
34 |
+
return secrets
|
35 |
+
|
36 |
+
# Parse the .env file
|
37 |
+
secrets = parse_env_file('.env')
|
38 |
+
|
39 |
+
# Upload each secret to the Hugging Face Space
|
40 |
+
for key, value in secrets.items():
|
41 |
+
try:
|
42 |
+
print(f"Setting secret: {key}")
|
43 |
+
api.add_space_secret(repo_id=repo_id, key=key, value=value)
|
44 |
+
print(f"β
Successfully set secret: {key}")
|
45 |
+
except Exception as e:
|
46 |
+
print(f"β Error setting secret {key}: {str(e)}")
|
47 |
+
|
48 |
+
print("\nAll secrets have been processed.")
|