Jonny001 commited on
Commit
08d4ee0
Β·
verified Β·
1 Parent(s): f6ec4cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -25
app.py CHANGED
@@ -69,7 +69,7 @@ def download_hf_repo_temp(repo_id):
69
  # Custom CSS for styling
70
  custom_css = """
71
  .gradio-container {
72
- max-width: 900px !important;
73
  margin: 0 auto;
74
  }
75
  .header {
@@ -92,18 +92,19 @@ custom_css = """
92
  opacity: 0.9;
93
  color: white;
94
  }
95
- .input-section {
96
  background: white;
97
  padding: 25px;
98
  border-radius: 12px;
99
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
100
- margin-bottom: 20px;
101
  }
102
- .output-section {
103
  background: white;
104
  padding: 25px;
105
  border-radius: 12px;
106
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
 
107
  }
108
  .download-btn {
109
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
@@ -115,6 +116,7 @@ custom_css = """
115
  font-size: 1.1em !important;
116
  transition: all 0.3s ease !important;
117
  width: 100%;
 
118
  }
119
  .download-btn:hover {
120
  transform: translateY(-2px);
@@ -125,6 +127,7 @@ custom_css = """
125
  border-radius: 10px !important;
126
  border: 2px solid #e1e5e9 !important;
127
  font-size: 1em !important;
 
128
  }
129
  .repo-input:focus {
130
  border-color: #667eea !important;
@@ -136,12 +139,15 @@ custom_css = """
136
  padding: 20px !important;
137
  border: 1px solid #e9ecef !important;
138
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
 
 
139
  }
140
  .file-output {
141
  padding: 20px !important;
142
  border-radius: 10px !important;
143
  background-color: #f0fff4 !important;
144
  border: 2px dashed #38a169 !important;
 
145
  }
146
  .section-title {
147
  font-size: 1.4em !important;
@@ -156,6 +162,10 @@ custom_css = """
156
  padding: 20px;
157
  border-top: 1px solid #e2e8f0;
158
  }
 
 
 
 
159
  """
160
 
161
  # Gradio UI with custom layout
@@ -171,13 +181,13 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Default()) as demo:
171
  </div>
172
  """)
173
 
174
- # Main content
175
- with gr.Row():
176
- with gr.Column(scale=1):
177
- # Input section
178
- gr.Markdown("### πŸ“¦ Repository Details", elem_classes=["section-title"])
179
-
180
- with gr.Group(elem_classes=["input-section"]):
181
  repo_input = gr.Textbox(
182
  label="Hugging Face Repository ID",
183
  placeholder="Enter username/repository_name (e.g., google/vit-base-patch16-224)",
@@ -185,40 +195,47 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Default()) as demo:
185
  lines=1
186
  )
187
 
 
 
 
 
 
 
 
 
188
  download_btn = gr.Button(
189
  "πŸš€ Download & ZIP",
190
  elem_classes=["download-btn"]
191
  )
192
 
193
- with gr.Column(scale=1):
194
- # Output section
195
- gr.Markdown("### πŸ“Š Status Log", elem_classes=["section-title"])
196
-
197
- with gr.Group(elem_classes=["output-section"]):
198
  log_output = gr.Textbox(
199
  label="",
200
- lines=10,
201
  interactive=False,
202
  elem_classes=["log-output"],
203
  show_label=False
204
  )
205
-
206
- # File download section
207
- with gr.Row():
208
- with gr.Column():
209
- gr.Markdown("### πŸ“₯ Download File", elem_classes=["section-title"])
210
 
211
- with gr.Group(elem_classes=["output-section"]):
 
 
212
  file_output = gr.File(
213
- label="Download your ZIP file here",
214
  elem_classes=["file-output"],
215
- file_count="single"
 
216
  )
217
 
218
  # Footer
219
  gr.HTML("""
220
  <div class="footer">
221
  <p>πŸ’‘ Note: Large repositories may take time to process. Files are automatically cleaned after download.</p>
 
222
  </div>
223
  """)
224
 
 
69
  # Custom CSS for styling
70
  custom_css = """
71
  .gradio-container {
72
+ max-width: 1200px !important;
73
  margin: 0 auto;
74
  }
75
  .header {
 
92
  opacity: 0.9;
93
  color: white;
94
  }
95
+ .input-card {
96
  background: white;
97
  padding: 25px;
98
  border-radius: 12px;
99
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
100
+ height: fit-content;
101
  }
102
+ .output-card {
103
  background: white;
104
  padding: 25px;
105
  border-radius: 12px;
106
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
107
+ height: 100%;
108
  }
109
  .download-btn {
110
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
 
116
  font-size: 1.1em !important;
117
  transition: all 0.3s ease !important;
118
  width: 100%;
119
+ margin-top: 15px;
120
  }
121
  .download-btn:hover {
122
  transform: translateY(-2px);
 
127
  border-radius: 10px !important;
128
  border: 2px solid #e1e5e9 !important;
129
  font-size: 1em !important;
130
+ width: 100%;
131
  }
132
  .repo-input:focus {
133
  border-color: #667eea !important;
 
139
  padding: 20px !important;
140
  border: 1px solid #e9ecef !important;
141
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
142
+ min-height: 200px;
143
+ height: 300px;
144
  }
145
  .file-output {
146
  padding: 20px !important;
147
  border-radius: 10px !important;
148
  background-color: #f0fff4 !important;
149
  border: 2px dashed #38a169 !important;
150
+ min-height: 100px;
151
  }
152
  .section-title {
153
  font-size: 1.4em !important;
 
162
  padding: 20px;
163
  border-top: 1px solid #e2e8f0;
164
  }
165
+ .main-grid {
166
+ gap: 25px !important;
167
+ align-items: stretch;
168
+ }
169
  """
170
 
171
  # Gradio UI with custom layout
 
181
  </div>
182
  """)
183
 
184
+ # Main content grid - Side by side layout
185
+ with gr.Row(elem_classes=["main-grid"]):
186
+ # Left column - Input
187
+ with gr.Column(scale=1, min_width=400):
188
+ with gr.Group(elem_classes=["input-card"]):
189
+ gr.Markdown("### πŸ“¦ Repository Input", elem_classes=["section-title"])
190
+
191
  repo_input = gr.Textbox(
192
  label="Hugging Face Repository ID",
193
  placeholder="Enter username/repository_name (e.g., google/vit-base-patch16-224)",
 
195
  lines=1
196
  )
197
 
198
+ gr.Markdown("""
199
+ **Format:** `username/repository_name`
200
+ **Examples:**
201
+ - `google/vit-base-patch16-224`
202
+ - `bert-base-uncased`
203
+ - `facebook/bart-large-cnn`
204
+ """)
205
+
206
  download_btn = gr.Button(
207
  "πŸš€ Download & ZIP",
208
  elem_classes=["download-btn"]
209
  )
210
 
211
+ # Right column - Output and Download
212
+ with gr.Column(scale=2, min_width=600):
213
+ # Status Log
214
+ with gr.Group(elem_classes=["output-card"]):
215
+ gr.Markdown("### πŸ“Š Status Log", elem_classes=["section-title"])
216
  log_output = gr.Textbox(
217
  label="",
218
+ lines=8,
219
  interactive=False,
220
  elem_classes=["log-output"],
221
  show_label=False
222
  )
 
 
 
 
 
223
 
224
+ # File Download
225
+ with gr.Group(elem_classes=["output-card"]):
226
+ gr.Markdown("### πŸ“₯ Download", elem_classes=["section-title"])
227
  file_output = gr.File(
228
+ label="Your ZIP file will appear here after download",
229
  elem_classes=["file-output"],
230
+ file_count="single",
231
+ interactive=False
232
  )
233
 
234
  # Footer
235
  gr.HTML("""
236
  <div class="footer">
237
  <p>πŸ’‘ Note: Large repositories may take time to process. Files are automatically cleaned after download.</p>
238
+ <p>⚑ Supports: Models β€’ Datasets β€’ Spaces</p>
239
  </div>
240
  """)
241