Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- Dockerfile +10 -0
- app.py +3 -2
Dockerfile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
COPY requirements.txt .
|
| 6 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
+
|
| 8 |
+
COPY app.py .
|
| 9 |
+
|
| 10 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
app.py
CHANGED
|
@@ -80,8 +80,9 @@ except Exception as e:
|
|
| 80 |
st.info("请确保 Hugging Face Token 已配置,且在 Space Settings 中设置了 HF_TOKEN secret。")
|
| 81 |
tree = []
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
|
|
|
| 85 |
|
| 86 |
total_size = sum(getattr(f, "size", 0) or 0 for f in files)
|
| 87 |
st.info(f"📊 {len(files)} 个文件 | {len(dirs)} 个目录 | 总大小: {format_size(total_size)}")
|
|
|
|
| 80 |
st.info("请确保 Hugging Face Token 已配置,且在 Space Settings 中设置了 HF_TOKEN secret。")
|
| 81 |
tree = []
|
| 82 |
|
| 83 |
+
# Distinguish files vs directories: folders have tree_id, files have blob_id
|
| 84 |
+
files = sorted([f for f in tree if hasattr(f, "blob_id")], key=lambda x: x.path)
|
| 85 |
+
dirs = sorted([f for f in tree if hasattr(f, "tree_id")], key=lambda x: x.path)
|
| 86 |
|
| 87 |
total_size = sum(getattr(f, "size", 0) or 0 for f in files)
|
| 88 |
st.info(f"📊 {len(files)} 个文件 | {len(dirs)} 个目录 | 总大小: {format_size(total_size)}")
|