Spaces:
Running on Zero

arpitjadon commited on
Commit
a0331bb
·
verified ·
1 Parent(s): 12e99b5

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +49 -23
app.py CHANGED
@@ -203,23 +203,37 @@ ICONS = {
203
  "weights": '<path d="M12 3l8 4.5v9L12 21l-8-4.5v-9z M4 7.5l8 4.5 8-4.5M12 12v9" fill="none" '
204
  'stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/>',
205
  }
 
 
 
 
 
 
 
 
 
 
 
 
206
  LINKS = [
207
- ("web", "Website", "https://openvisionbanana.github.io/"),
208
- ("paper", "Paper", "https://arxiv.org/abs/2611.15844"),
209
- ("code", "Code", "https://github.com/OpenVisionBanana/OpenVisionBanana"),
210
- ("weights", "Models", "https://huggingface.co/FunAILab/Open-Vision-Banana"),
 
 
211
  ]
212
- LOGO = HERE / "ovb_logo.png"
213
  HEADER = f"""
214
  <div class="ovb-header">
215
- <div class="ovb-brand">
216
- <img class="ovb-logo" alt="" src="data:image/png;base64,{base64.b64encode(LOGO.read_bytes()).decode()}">
217
- <div class="ovb-title">Open Vision Banana</div>
 
 
 
 
 
218
  </div>
219
- <div class="ovb-links">{"".join(
220
- f'<a href="{href}" target="_blank" rel="noopener noreferrer">'
221
- f'<svg viewBox="0 0 24 24" aria-hidden="true">{ICONS[icon]}</svg>{label}</a>'
222
- for icon, label, href in LINKS)}</div>
223
  <p class="ovb-intro">
224
  One fine-tuned FLUX.2 [klein] Base 9B model redraws a photo as a semantic segmentation,
225
  single-class instance segmentation, referring segmentation, depth map, normal map, or edits it
@@ -245,20 +259,32 @@ HEAD = ('<link rel="preconnect" href="https://fonts.googleapis.com">'
245
 
246
  CSS = """
247
  .gradio-container { max-width: 1280px !important; margin: 0 auto !important; }
248
- .ovb-header { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
249
- padding: 18px 4px 24px; color: var(--body-text-color); }
 
 
250
  .ovb-brand { display: flex; align-items: center; gap: 12px; }
251
  .ovb-logo { width: 46px; height: auto; }
252
- .ovb-title { font-family: 'Instrument Serif', Georgia, serif; font-size: 46px; line-height: 50px; }
253
- .ovb-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
254
  .ovb-links a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px;
255
- font-size: 13px; font-weight: 500; text-decoration: none !important; color: var(--body-text-color) !important;
256
- border: 1px solid var(--border-color-primary); background: var(--block-background-fill);
257
- transition: transform .15s ease, border-color .15s ease, background-color .15s ease; }
258
- .ovb-links a:hover { transform: translateY(-1px); border-color: #FFD43B; background: rgba(255, 212, 59, .14); }
259
- .ovb-links svg { width: 15px; height: 15px; }
260
- .ovb-intro { margin: 0; max-width: 860px; font-size: 14px; line-height: 22px; color: var(--body-text-color-subdued); }
261
- @media (max-width: 900px) {
 
 
 
 
 
 
 
 
 
 
262
  .ovb-title { font-size: 34px; line-height: 38px; }
263
  .ovb-logo { width: 36px; }
264
  .ovb-intro { font-size: 13px; line-height: 19px; }
 
203
  "weights": '<path d="M12 3l8 4.5v9L12 21l-8-4.5v-9z M4 7.5l8 4.5 8-4.5M12 12v9" fill="none" '
204
  'stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/>',
205
  }
206
+ LOGO = HERE / "ovb_logo.png"
207
+ LOGO_SRC = f"data:image/png;base64,{base64.b64encode(LOGO.read_bytes()).decode()}"
208
+ GITHUB_MARK = ( # GitHub's mark (Primer octicon "mark-github")
209
+ '<svg viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 '
210
+ '3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23'
211
+ '-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87'
212
+ '.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82'
213
+ '.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 '
214
+ '1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38'
215
+ 'A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>')
216
+ # Each button in its source's colours: project site (cream and banana yellow), arXiv red,
217
+ # GitHub near-black, Hugging Face yellow.
218
  LINKS = [
219
+ ("web", f'<img src="{LOGO_SRC}" alt="">', "Website", "https://openvisionbanana.github.io/"),
220
+ ("paper", f'<svg viewBox="0 0 24 24" aria-hidden="true">{ICONS["paper"]}</svg>', "Paper",
221
+ "https://arxiv.org/abs/2611.15844"),
222
+ ("code", GITHUB_MARK, "Code", "https://github.com/OpenVisionBanana/OpenVisionBanana"),
223
+ ("models", '<img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" alt="">', "Models",
224
+ "https://huggingface.co/FunAILab/Open-Vision-Banana"),
225
  ]
 
226
  HEADER = f"""
227
  <div class="ovb-header">
228
+ <div class="ovb-identity">
229
+ <div class="ovb-brand">
230
+ <img class="ovb-logo" alt="" src="{LOGO_SRC}">
231
+ <div class="ovb-title">Open Vision Banana</div>
232
+ </div>
233
+ <div class="ovb-links">{"".join(
234
+ f'<a class="ovb-link-{key}" href="{href}" target="_blank" rel="noopener noreferrer">{icon}{label}</a>'
235
+ for key, icon, label, href in LINKS)}</div>
236
  </div>
 
 
 
 
237
  <p class="ovb-intro">
238
  One fine-tuned FLUX.2 [klein] Base 9B model redraws a photo as a semantic segmentation,
239
  single-class instance segmentation, referring segmentation, depth map, normal map, or edits it
 
259
 
260
  CSS = """
261
  .gradio-container { max-width: 1280px !important; margin: 0 auto !important; }
262
+ .ovb-header { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: center;
263
+ padding: 16px 4px 22px; color: var(--body-text-color); }
264
+ .ovb-identity { display: flex; flex-direction: column; gap: 12px; padding-right: 32px;
265
+ border-right: 1px solid var(--border-color-primary); }
266
  .ovb-brand { display: flex; align-items: center; gap: 12px; }
267
  .ovb-logo { width: 46px; height: auto; }
268
+ .ovb-title { font-family: 'Instrument Serif', Georgia, serif; font-size: 46px; line-height: 50px; white-space: nowrap; }
269
+ .ovb-links { display: flex; flex-wrap: wrap; gap: 8px; }
270
  .ovb-links a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px;
271
+ font-size: 13px; font-weight: 600; text-decoration: none !important; border: 1px solid transparent;
272
+ transition: transform .15s ease, filter .15s ease; }
273
+ .ovb-links a:hover { transform: translateY(-1px); filter: brightness(1.08); }
274
+ .ovb-links svg, .ovb-links img { width: 15px; height: 15px; }
275
+ .ovb-links img { object-fit: contain; }
276
+ .ovb-links a.ovb-link-web { background: #fffef9; color: #171713 !important; border-color: #ffca28; }
277
+ .ovb-links a.ovb-link-paper { background: #b31b1b; color: #ffffff !important; }
278
+ .ovb-links a.ovb-link-code { background: #24292f; color: #ffffff !important; }
279
+ .ovb-links a.ovb-link-models { background: #ffd21e; color: #171713 !important; }
280
+ .dark .ovb-links a.ovb-link-code { border-color: #3d444d; }
281
+ .ovb-intro { margin: 0; font-size: 14.5px; line-height: 23px; color: var(--body-text-color); text-wrap: pretty; }
282
+ /* Below 1024 px Gradio narrows the page to 768 px or less: stack the intro under the title. */
283
+ @media (max-width: 1023px) {
284
+ .ovb-header { grid-template-columns: minmax(0, 1fr); gap: 12px; }
285
+ .ovb-identity { border-right: 0; padding: 0 0 12px; border-bottom: 1px solid var(--border-color-primary); }
286
+ }
287
+ @media (max-width: 640px) {
288
  .ovb-title { font-size: 34px; line-height: 38px; }
289
  .ovb-logo { width: 36px; }
290
  .ovb-intro { font-size: 13px; line-height: 19px; }