shaico111 commited on
Commit
83ff38c
·
verified ·
1 Parent(s): b421bc2

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -188,3 +188,28 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
188
  שנה[[:space:]]ב/סמסטר[[:space:]]א/אינפי[[:space:]]2/הקלטות/קישורים[[:space:]]לזום[[:space:]]לימודים[[:space:]]-[[:space:]]מדעי[[:space:]]המחשב[[:space:]]HIT_.xlsx filter=lfs diff=lfs merge=lfs -text
189
  שנה[[:space:]]א/תכנות[[:space:]]מונחה[[:space:]]עצמים/מבחנים/2024/סמ׳[[:space:]]ב[[:space:]]מועד[[:space:]]ב[[:space:]]+[[:space:]]פתרון filter=lfs diff=lfs merge=lfs -text
190
  שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/2011/2011[[:space:]]מועד[[:space:]]א-מחברת.PDF filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  שנה[[:space:]]ב/סמסטר[[:space:]]א/אינפי[[:space:]]2/הקלטות/קישורים[[:space:]]לזום[[:space:]]לימודים[[:space:]]-[[:space:]]מדעי[[:space:]]המחשב[[:space:]]HIT_.xlsx filter=lfs diff=lfs merge=lfs -text
189
  שנה[[:space:]]א/תכנות[[:space:]]מונחה[[:space:]]עצמים/מבחנים/2024/סמ׳[[:space:]]ב[[:space:]]מועד[[:space:]]ב[[:space:]]+[[:space:]]פתרון filter=lfs diff=lfs merge=lfs -text
190
  שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/2011/2011[[:space:]]מועד[[:space:]]א-מחברת.PDF filter=lfs diff=lfs merge=lfs -text
191
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ופתרונות[[:space:]]של[[:space:]]המרצה[[:space:]]ד״ר[[:space:]]אילת[[:space:]]בוטמן/מבנה[[:space:]]נתונים[[:space:]]2019[[:space:]]סמסטר[[:space:]][[:space:]]ב[[:space:]]מועד[[:space:]]א[[:space:]]-[[:space:]]פתרון.docx filter=lfs diff=lfs merge=lfs -text
192
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/מבחן[[:space:]]לדוגמה[[:space:]]תשסח.doc filter=lfs diff=lfs merge=lfs -text
193
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/בן[[:space:]]גוריון/מבחן[[:space:]]2004[[:space:]]מועד[[:space:]]א[[:space:]]+[[:space:]]פתרון.doc filter=lfs diff=lfs merge=lfs -text
194
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/בן[[:space:]]גוריון/מבחן[[:space:]]2006[[:space:]]מועד[[:space:]]א[[:space:]]+[[:space:]]פתרון.doc filter=lfs diff=lfs merge=lfs -text
195
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/טכניון/93160_moeda-spring-2007.doc filter=lfs diff=lfs merge=lfs -text
196
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/תרגילים/תרגילים[[:space:]]ופתרונות[[:space:]]משנה[[:space:]]שעברה/שתי[[:space:]]סוגי[[:space:]]פתרונות[[:space:]]ל-7[[:space:]]שאלה[[:space:]]5.doc filter=lfs diff=lfs merge=lfs -text
197
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/מבחנים/מבחנים[[:space:]]לא[[:space:]]מבר[[:space:]]אילן/Data[[:space:]]Stracture03a.tif filter=lfs diff=lfs merge=lfs -text
198
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/מבחנים/מבחנים[[:space:]]לא[[:space:]]מבר[[:space:]]אילן/ds[[:space:]]04a(b)+b(b)+c(a).tif filter=lfs diff=lfs merge=lfs -text
199
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/מבחנים/מבחנים[[:space:]]לא[[:space:]]מבר[[:space:]]אילן/ds[[:space:]]04b.tif filter=lfs diff=lfs merge=lfs -text
200
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/מבחנים/מבחנים[[:space:]]לא[[:space:]]מבר[[:space:]]אילן/ds[[:space:]]05a.tif filter=lfs diff=lfs merge=lfs -text
201
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/מבחנים/מבחנים[[:space:]]לא[[:space:]]מבר[[:space:]]אילן/Data[[:space:]]Structure[[:space:]]-[[:space:]]exams-and-sol/ds03aa+sol1.doc filter=lfs diff=lfs merge=lfs -text
202
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/מבחנים/מבחנים[[:space:]]לא[[:space:]]מבר[[:space:]]אילן/Data[[:space:]]Structure[[:space:]]-[[:space:]]exams-and-sol/ds03b-SOL.doc filter=lfs diff=lfs merge=lfs -text
203
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/מבחנים/מבחנים[[:space:]]לא[[:space:]]מבר[[:space:]]אילן/Data[[:space:]]Structure[[:space:]]-[[:space:]]exams-and-sol/ds03ba-SOL.doc filter=lfs diff=lfs merge=lfs -text
204
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/מבחנים[[:space:]]ממקומות[[:space:]]אחרים/חומר[[:space:]]מבר[[:space:]]אילן[[:space:]]הנדסה/מבחנים/מבחנים[[:space:]]לא[[:space:]]מבר[[:space:]]אילן/Data[[:space:]]Structure[[:space:]]-[[:space:]]exams-and-sol/ds04aa-ans.doc filter=lfs diff=lfs merge=lfs -text
205
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/2023/מחברות/מועד[[:space:]]א/2023[[:space:]]מועד[[:space:]]א[[:space:]]מחברת[[:space:]]94[[:space:]]מבני[[:space:]]נתונים[[:space:]]תשפג.PDF filter=lfs diff=lfs merge=lfs -text
206
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/2023/מחברות/מועד[[:space:]]א/2023[[:space:]]מועד[[:space:]]א[[:space:]]מחברת[[:space:]]97[[:space:]]א[[:space:]]מבני[[:space:]]נתונים[[:space:]]תשפג.PDF filter=lfs diff=lfs merge=lfs -text
207
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/2023/מחברות/מועד[[:space:]]א/2023[[:space:]]מועד[[:space:]]א[[:space:]]מחברת[[:space:]]97[[:space:]]ב[[:space:]]מבני[[:space:]]נתונים[[:space:]]תשפג.PDF filter=lfs diff=lfs merge=lfs -text
208
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/2015/מחברות/מועד[[:space:]]א/2015[[:space:]]מועד[[:space:]]א-פתרון[[:space:]]וטעויות.doc filter=lfs diff=lfs merge=lfs -text
209
+ שנה[[:space:]]א/מבני[[:space:]]נתונים/מבחנים/2012/מחברות/2012[[:space:]]מועד[[:space:]]א-טופס.docx filter=lfs diff=lfs merge=lfs -text
210
+ שנה[[:space:]]א/מבוא[[:space:]]למדעי[[:space:]]המחשב/מבחנים/2016/סמ׳[[:space:]]ב[[:space:]]מועד[[:space:]]א[[:space:]]+[[:space:]]פתרון.docx filter=lfs diff=lfs merge=lfs -text
211
+ שנה[[:space:]]א/מבוא[[:space:]]למדעי[[:space:]]המחשב/מבחנים/2016/סמ׳[[:space:]]ב[[:space:]]מועד[[:space:]]ב[[:space:]]+[[:space:]]פתרון.docx filter=lfs diff=lfs merge=lfs -text
212
+ שנה[[:space:]]א/מבוא[[:space:]]למדעי[[:space:]]המחשב/מבחנים/2017/מועד[[:space:]]א[[:space:]]קורס[[:space:]]חוזר[[:space:]]+[[:space:]]פתרון.docx filter=lfs diff=lfs merge=lfs -text
213
+ שנה[[:space:]]א/מבוא[[:space:]]למדעי[[:space:]]המחשב/מבחנים/2017/מועד[[:space:]]ב[[:space:]]קורס[[:space:]]חוזר[[:space:]]+[[:space:]]פתרון.docx filter=lfs diff=lfs merge=lfs -text
214
+ שנה[[:space:]]א/בדידה[[:space:]]2/מבחנים/2015/2015[[:space:]]סמ׳[[:space:]]א[[:space:]]מועד[[:space:]]א[[:space:]]+[[:space:]]פתרון.doc filter=lfs diff=lfs merge=lfs -text
215
+ שנה[[:space:]]א/בדידה[[:space:]]1/מבחנים/2015/2015[[:space:]]סמ׳[[:space:]]א[[:space:]]מועד[[:space:]]א[[:space:]]+[[:space:]]פתרון.doc filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -1 +1,29 @@
1
- upload_to_hf.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ upload_to_hf.py
2
+ .cursor/
3
+
4
+ # Repo-specific scratch/outputs
5
+ .tmp-space/
6
+ cs26-portal/
7
+
8
+ # Python
9
+ __pycache__/
10
+ *.py[cod]
11
+ *.pyd
12
+ .Python
13
+ .venv/
14
+ venv/
15
+ ENV/
16
+ env/
17
+ .mypy_cache/
18
+ .pytest_cache/
19
+ .ruff_cache/
20
+ .cache/
21
+
22
+ # OS/editor junk
23
+ .DS_Store
24
+ Thumbs.db
25
+ Desktop.ini
26
+ $RECYCLE.BIN/
27
+
28
+ # Logs
29
+ *.log
.tmp-space/cs26-portal/.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
.tmp-space/cs26-portal/README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Cs26 Portal
3
+ emoji: 🐠
4
+ colorFrom: purple
5
+ colorTo: gray
6
+ sdk: gradio
7
+ sdk_version: 6.13.0
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
.tmp-space/cs26-portal/app.py ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import HfApi, snapshot_download
3
+ import pandas as pd
4
+ import os
5
+ import json
6
+ import tempfile
7
+ import zipfile
8
+ import shutil
9
+
10
+ api = HfApi()
11
+ DATASET_REPO = "CS26/Computer-Science"
12
+
13
+ PREVIEW_EXTS = {
14
+ ".pdf",
15
+ ".png", ".jpg", ".jpeg", ".gif", ".webp",
16
+ ".txt", ".md", ".csv", ".json",
17
+ ".py", ".ipynb",
18
+ ".html", ".htm",
19
+ }
20
+
21
+ def get_all_files():
22
+ try:
23
+ files = api.list_repo_files(DATASET_REPO, repo_type="dataset")
24
+ return [f for f in files if not f.startswith(".git") and not f.startswith(".huggingface")]
25
+ except Exception as e:
26
+ print(f"Error fetching files: {e}")
27
+ return []
28
+
29
+ def click_js(path, kind, file_action="open"):
30
+ """Generates the Javascript to trigger the hidden Gradio textbox on click or open a file."""
31
+ path_json = json.dumps(path).replace("'", "'")
32
+ if kind == "Directory":
33
+ # For directories, update the hidden input using standard DOM value setter
34
+ return f'''
35
+ event.stopPropagation();
36
+ try {{
37
+ localStorage.setItem("cs26_current_path", {path_json});
38
+ // Use hash for statefulness (most reliable across Gradio hosting)
39
+ window.location.hash = encodeURIComponent({path_json});
40
+ }} catch (e) {{}}
41
+ const elem = document.querySelector("#hidden_path_input textarea");
42
+ if(elem) {{
43
+ elem.value = JSON.stringify({{path: {path_json}, rand: Math.random()}});
44
+ elem.dispatchEvent(new Event("input", {{ bubbles: true }}));
45
+ }} else {{
46
+ console.error("Hidden input not found in DOM!");
47
+ }}
48
+ '''
49
+ else:
50
+ # It's a file. Either open in new tab or force-download.
51
+ file_action_json = json.dumps(file_action)
52
+ return f'''
53
+ event.stopPropagation();
54
+ const path = {path_json};
55
+ const file_action = {file_action_json};
56
+ const baseUrl = "https://huggingface.co/datasets/{DATASET_REPO}/resolve/main/" + path;
57
+ if (file_action === "download") {{
58
+ // Force download via HF parameter (more reliable than <a download> cross-origin)
59
+ window.open(baseUrl + "?download=true", "_blank");
60
+ }} else {{
61
+ window.open(baseUrl, "_blank");
62
+ }}
63
+ '''
64
+
65
+ def get_drive_html(current_path, search_query, all_files):
66
+ prefix = current_path + "/" if current_path else ""
67
+
68
+ all_dirs_in_path = set()
69
+ files_in_path = []
70
+
71
+ for f in all_files:
72
+ if f.startswith(prefix):
73
+ files_in_path.append(f)
74
+ parts = f.split("/")
75
+ for i in range(1, len(parts)):
76
+ dir_path = "/".join(parts[:i])
77
+ if dir_path.startswith(prefix) or not prefix:
78
+ all_dirs_in_path.add(dir_path)
79
+
80
+ dirs = set()
81
+ files = set()
82
+
83
+ if search_query:
84
+ query = search_query.lower()
85
+ for f in files_in_path:
86
+ if query in os.path.basename(f).lower():
87
+ files.add(f)
88
+ for d in all_dirs_in_path:
89
+ if query in os.path.basename(d).lower():
90
+ dirs.add(d)
91
+ else:
92
+ for f in files_in_path:
93
+ remainder = f[len(prefix):]
94
+ parts = remainder.split("/")
95
+ if len(parts) == 1:
96
+ files.add(f)
97
+ else:
98
+ dirs.add(prefix + parts[0]) # Stores the FULL PATH
99
+
100
+ html = """
101
+ <style>
102
+ .drive-container {
103
+ display: flex;
104
+ flex-wrap: wrap;
105
+ gap: 16px;
106
+ padding: 10px 20px 30px 20px;
107
+ background-color: var(--background-fill-primary);
108
+ font-family: "Google Sans", Roboto, Arial, sans-serif;
109
+ border-radius: 12px;
110
+ box-shadow: 0 1px 3px rgba(0,0,0,0.1);
111
+ border: 1px solid var(--border-color-primary);
112
+ }
113
+ .drive-section-title {
114
+ width: 100%;
115
+ font-size: 14px;
116
+ font-weight: 500;
117
+ color: var(--body-text-color-subdued);
118
+ margin-top: 15px;
119
+ margin-bottom: 5px;
120
+ }
121
+ .drive-item {
122
+ width: 100%;
123
+ max-width: 240px;
124
+ height: 48px;
125
+ display: flex;
126
+ align-items: center;
127
+ padding: 0 15px;
128
+ background: var(--background-fill-secondary);
129
+ border: 1px solid var(--border-color-primary);
130
+ border-radius: 8px;
131
+ cursor: pointer;
132
+ user-select: none;
133
+ transition: background 0.15s ease;
134
+ color: var(--body-text-color);
135
+ }
136
+ .drive-item:hover {
137
+ background: var(--background-fill-secondary-hover);
138
+ }
139
+ .file-item {
140
+ display: flex;
141
+ flex-direction: column;
142
+ width: 100%;
143
+ max-width: 240px;
144
+ height: 200px;
145
+ padding: 0;
146
+ background: var(--background-fill-secondary);
147
+ border: 1px solid var(--border-color-primary);
148
+ border-radius: 8px;
149
+ cursor: pointer;
150
+ overflow: hidden;
151
+ transition: background 0.15s ease;
152
+ color: var(--body-text-color);
153
+ }
154
+ .file-item:hover {
155
+ background: var(--background-fill-secondary-hover);
156
+ }
157
+ .file-preview {
158
+ height: 140px;
159
+ width: 100%;
160
+ background: var(--background-fill-primary);
161
+ border-bottom: 1px solid var(--border-color-primary);
162
+ display: flex;
163
+ align-items: center;
164
+ justify-content: center;
165
+ font-size: 55px;
166
+ }
167
+ .file-info {
168
+ height: 60px;
169
+ display: flex;
170
+ align-items: center;
171
+ padding: 0 15px;
172
+ }
173
+ .drive-icon {
174
+ font-size: 20px;
175
+ margin-right: 12px;
176
+ }
177
+ .drive-name {
178
+ font-size: 14px;
179
+ white-space: nowrap;
180
+ overflow: hidden;
181
+ text-overflow: ellipsis;
182
+ font-weight: 500;
183
+ font-family: "Google Sans", Roboto, Arial, sans-serif;
184
+ }
185
+ .breadcrumb-container {
186
+ font-size: 22px;
187
+ font-family: 'Google Sans', sans-serif;
188
+ color: var(--body-text-color);
189
+ margin: 15px 20px;
190
+ display: flex;
191
+ align-items: center;
192
+ gap: 8px;
193
+ flex-wrap: wrap;
194
+ }
195
+ .breadcrumb-item {
196
+ cursor: pointer;
197
+ padding: 5px 10px;
198
+ border-radius: 6px;
199
+ transition: background 0.2s;
200
+ }
201
+ .breadcrumb-item:hover {
202
+ background: var(--background-fill-secondary-hover);
203
+ }
204
+ .breadcrumb-separator {
205
+ color: var(--body-text-color-subdued);
206
+ font-size: 20px;
207
+ }
208
+ /* Mobile adjustments */
209
+ @media (max-width: 600px) {
210
+ .drive-item, .file-item {
211
+ max-width: 100%;
212
+ }
213
+ .breadcrumb-container {
214
+ font-size: 18px;
215
+ }
216
+ }
217
+ </style>
218
+ """
219
+
220
+ # Breadcrumbs mimicking Google Drive
221
+ parts = current_path.split("/") if current_path else []
222
+ bc_html = '<div class="breadcrumb-container">'
223
+ bc_html += f'<span class="breadcrumb-item" onclick=\'{click_js("", "Directory")}\'>CS26</span>'
224
+ accumulated = []
225
+ for p in parts:
226
+ accumulated.append(p)
227
+ curr = "/".join(accumulated)
228
+ bc_html += '<span class="breadcrumb-separator">›</span>'
229
+ bc_html += f'<span class="breadcrumb-item" onclick=\'{click_js(curr, "Directory")}\'>{p}</span>'
230
+ bc_html += '</div>'
231
+
232
+ html += bc_html
233
+ html += '<div class="drive-container">'
234
+
235
+ if search_query:
236
+ html += f'<div class="drive-section-title">תוצאות חיפוש עבור \"{search_query}\"</div>'
237
+
238
+ if dirs:
239
+ html += '<div class="drive-section-title">תיקיות</div>'
240
+ for d in sorted(dirs):
241
+ full_path = d # d is already the full path!
242
+ name = os.path.basename(d) # Extract just the name
243
+ html += f'''
244
+ <div class="drive-item" onclick='{click_js(full_path, "Directory")}'>
245
+ <div class="drive-icon">📁</div>
246
+ <div class="drive-name" title="{name}">{name}</div>
247
+ </div>
248
+ '''
249
+
250
+ if files:
251
+ html += '<div class="drive-section-title">קבצים</div>'
252
+ for f in sorted(files):
253
+ name = os.path.basename(f)
254
+ full_path = f # f is already the full path!
255
+
256
+ icon = "📄"
257
+ lower = name.lower()
258
+ if lower.endswith(".pdf"): icon = "📕"
259
+ elif lower.endswith(('.png', '.jpg', '.jpeg', '.gif', '.webp')): icon = "🖼️"
260
+ elif lower.endswith(('.docx', '.doc')): icon = "📝"
261
+ elif lower.endswith(('.pptx', '.ppt')): icon = "📊"
262
+ elif lower.endswith(('.xlsx', '.xls')): icon = "📈"
263
+ elif lower.endswith(('.zip', '.rar', '.7z', '.tar', '.gz')): icon = "🗜️"
264
+ elif lower.endswith(".ipynb"): icon = "📓"
265
+ elif lower.endswith(".py"): icon = "🐍"
266
+
267
+ ext = os.path.splitext(lower)[1]
268
+ file_action = "open" if ext in PREVIEW_EXTS else "download"
269
+
270
+ html += f'''
271
+ <div class="file-item" onclick='{click_js(full_path, "File", file_action=file_action)}'>
272
+ <div class="file-preview">{icon}</div>
273
+ <div class="file-info">
274
+ <div class="drive-icon">{icon}</div>
275
+ <div class="drive-name" title="{name}">{name}</div>
276
+ </div>
277
+ </div>
278
+ '''
279
+
280
+ if not dirs and not files:
281
+ html += '<div style="width: 100%; text-align: center; color: var(--body-text-color-subdued); padding: 50px; font-family: Google Sans;">התיקייה ריקה.</div>'
282
+
283
+ html += "</div>"
284
+ return html
285
+
286
+ def handle_click(json_str, current_path, search_query, all_files):
287
+ """Handles the selection of a folder from the custom UI."""
288
+ if not json_str:
289
+ return current_path, search_query, gr.update(), gr.update(visible=False)
290
+
291
+ try:
292
+ data = json.loads(json_str)
293
+ path = data.get("path", "")
294
+ except Exception:
295
+ path = json_str # fallback if it's just a string
296
+
297
+ new_path = path if path else ""
298
+ # Hide the zip file download component when navigating
299
+ html_view = get_drive_html(new_path, "", all_files)
300
+ return new_path, "", html_view, gr.update(visible=False)
301
+
302
+ def refresh_data():
303
+ files = get_all_files()
304
+ html_view = get_drive_html("", "", files)
305
+ return files, "", "", html_view, gr.update(visible=False)
306
+
307
+ def do_search(search_query, current_path, all_files):
308
+ html_view = get_drive_html(current_path, search_query, all_files)
309
+ return current_path, search_query, html_view, gr.update(visible=False)
310
+
311
+ def prepare_zip(current_path, progress=gr.Progress()):
312
+ folder = current_path if current_path else ""
313
+ zip_name = f"{os.path.basename(folder)}.zip" if folder else "CS26_All.zip"
314
+ pattern = f"{folder}/**" if folder else "**"
315
+
316
+ try:
317
+ progress(0.1, desc="מוריד קבצים מ-Hugging Face...")
318
+ # Use allow_patterns to only download the needed files to save bandwidth/time
319
+ local_dir = snapshot_download(repo_id=DATASET_REPO, repo_type="dataset", allow_patterns=pattern)
320
+ zip_path = os.path.join(tempfile.gettempdir(), zip_name)
321
+
322
+ progress(0.7, desc="יוצר קובץ ZIP...")
323
+ target_dir = os.path.join(local_dir, folder) if folder else local_dir
324
+ with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
325
+ for root, _, files in os.walk(target_dir):
326
+ for file in files:
327
+ if '.git' in root or '.huggingface' in root: continue
328
+ file_path = os.path.join(root, file)
329
+ arcname = os.path.relpath(file_path, target_dir)
330
+ zipf.write(file_path, arcname)
331
+ progress(1.0, desc="ה-ZIP מוכן!")
332
+ return gr.update(value=zip_path, visible=True)
333
+ except Exception as e:
334
+ print(f"Error creating zip: {e}")
335
+ return gr.update(visible=False)
336
+
337
+ APP_CSS = """
338
+ /* RTL + Hebrew-friendly defaults */
339
+ body, .gradio-container {
340
+ direction: rtl;
341
+ text-align: right;
342
+ }
343
+ .breadcrumb-container {
344
+ direction: rtl;
345
+ }
346
+ """
347
+
348
+ with gr.Blocks(title="CS26 Dataset Explorer", theme=gr.themes.Default(), css=APP_CSS) as demo:
349
+ all_files_state = gr.State([])
350
+ current_path_state = gr.State("")
351
+
352
+ # Hidden textbox used as a bridge between Javascript clicks and Python
353
+ hidden_path_input = gr.Textbox(elem_id="hidden_path_input", container=False)
354
+ gr.HTML("<style>#hidden_path_input { display: none !important; }</style>")
355
+ gr.HTML("""
356
+ <script>
357
+ (function() {
358
+ function restorePathOnce() {
359
+ try {
360
+ const hashPath = (window.location.hash || "").replace(/^#/, "");
361
+ const fromHash = hashPath ? decodeURIComponent(hashPath) : "";
362
+ const saved = fromHash || localStorage.getItem("cs26_current_path") || "";
363
+ if (!saved) return;
364
+ const elem = document.querySelector("#hidden_path_input textarea");
365
+ if (!elem) return;
366
+ elem.value = JSON.stringify({path: saved, rand: Math.random()});
367
+ elem.dispatchEvent(new Event("input", { bubbles: true }));
368
+ } catch (e) {}
369
+ }
370
+ window.addEventListener("load", () => setTimeout(restorePathOnce, 50));
371
+ })();
372
+ </script>
373
+ """)
374
+
375
+ with gr.Row():
376
+ gr.Markdown("# ☁️ סייר קבצים")
377
+ gr.Markdown(f"**{DATASET_REPO}**")
378
+
379
+ with gr.Row(equal_height=True):
380
+ search_box = gr.Textbox(show_label=False, container=False, placeholder="🔍 חיפוש בתיקייה הנוכחית (Enter)", scale=5)
381
+ search_btn = gr.Button("🔍 חיפוש", scale=1, min_width=110)
382
+
383
+ with gr.Row():
384
+ refresh_btn = gr.Button("🔄 רענון", scale=1, min_width=110)
385
+ zip_btn = gr.Button("📦 הכנת קובץ ZIP לתיקייה", scale=1, min_width=190)
386
+
387
+ with gr.Row():
388
+ zip_file = gr.File(label="הורדה מוכנה!", visible=False)
389
+
390
+ drive_view = gr.HTML()
391
+
392
+ # Initial load
393
+ demo.load(
394
+ fn=refresh_data,
395
+ inputs=[],
396
+ outputs=[all_files_state, current_path_state, search_box, drive_view, zip_file]
397
+ )
398
+
399
+ # Listen to changes on the hidden textbox to handle JS clicks
400
+ hidden_path_input.change(
401
+ fn=handle_click,
402
+ inputs=[hidden_path_input, current_path_state, search_box, all_files_state],
403
+ outputs=[current_path_state, search_box, drive_view, zip_file]
404
+ )
405
+
406
+ refresh_btn.click(
407
+ fn=refresh_data,
408
+ inputs=[],
409
+ outputs=[all_files_state, current_path_state, search_box, drive_view, zip_file]
410
+ )
411
+
412
+ search_box.submit(
413
+ fn=do_search,
414
+ inputs=[search_box, current_path_state, all_files_state],
415
+ outputs=[current_path_state, search_box, drive_view, zip_file]
416
+ )
417
+
418
+ search_btn.click(
419
+ fn=do_search,
420
+ inputs=[search_box, current_path_state, all_files_state],
421
+ outputs=[current_path_state, search_box, drive_view, zip_file]
422
+ )
423
+
424
+ zip_btn.click(
425
+ fn=prepare_zip,
426
+ inputs=[current_path_state],
427
+ outputs=[zip_file]
428
+ )
429
+
430
+ if __name__ == "__main__":
431
+ demo.launch()
.tmp-space/cs26-portal/requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ huggingface_hub
3
+ pandas