Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- Dockerfile +2 -1
- check_logs.py +28 -0
Dockerfile
CHANGED
|
@@ -2,7 +2,8 @@ FROM python:3.11-slim
|
|
| 2 |
|
| 3 |
# Set environment variables
|
| 4 |
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
-
PYTHONDONTWRITEBYTECODE=1
|
|
|
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
|
|
|
|
| 2 |
|
| 3 |
# Set environment variables
|
| 4 |
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
+
PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
+
LAST_BUILD=2026-03-28T18:32:00
|
| 7 |
|
| 8 |
WORKDIR /app
|
| 9 |
|
check_logs.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import os
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
|
| 5 |
+
load_dotenv()
|
| 6 |
+
token = os.getenv("HF_TOKEN")
|
| 7 |
+
repo_id = "Ismail131/smart-contract-audit-env"
|
| 8 |
+
|
| 9 |
+
def get_logs(log_type):
|
| 10 |
+
url = f"https://huggingface.co/api/spaces/{repo_id}/logs/{log_type}"
|
| 11 |
+
headers = {"Authorization": f"Bearer {token}"}
|
| 12 |
+
try:
|
| 13 |
+
response = requests.get(url, headers=headers)
|
| 14 |
+
if response.status_code == 200:
|
| 15 |
+
print(f"--- {log_type.upper()} LOGS ---")
|
| 16 |
+
print(response.text[-2000:]) # Last 2000 chars
|
| 17 |
+
else:
|
| 18 |
+
print(f"Failed to get {log_type} logs: {response.status_code} - {response.text}")
|
| 19 |
+
except Exception as e:
|
| 20 |
+
print(f"Error fetching {log_type} logs: {str(e)}")
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
if not token:
|
| 24 |
+
print("HF_TOKEN not found in .env")
|
| 25 |
+
else:
|
| 26 |
+
get_logs("build")
|
| 27 |
+
print("\n" + "="*50 + "\n")
|
| 28 |
+
get_logs("container")
|