akhaliq HF Staff commited on
Commit
2ef6ad8
·
verified ·
1 Parent(s): a6f47af

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +40 -34
  2. requirements.txt +3 -1
app.py CHANGED
@@ -110,36 +110,6 @@ def generate_image(
110
  except Exception as e:
111
  raise gr.Error(f"Generation failed: {str(e)}")
112
 
113
- # Create Apple-inspired theme
114
- apple_theme = gr.themes.Soft(
115
- primary_hue=gr.themes.colors.blue,
116
- secondary_hue=gr.themes.colors.slate,
117
- neutral_hue=gr.themes.colors.gray,
118
- spacing_size=gr.themes.sizes.spacing_lg,
119
- radius_size=gr.themes.sizes.radius_lg,
120
- text_size=gr.themes.sizes.text_md,
121
- font=[gr.themes.GoogleFont("Inter"), "SF Pro Display", "-apple-system", "BlinkMacSystemFont", "system-ui", "sans-serif"],
122
- font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "SF Mono", "ui-monospace", "monospace"],
123
- ).set(
124
- body_background_fill='#f5f5f7',
125
- body_background_fill_dark='#000000',
126
- button_primary_background_fill='#0071e3',
127
- button_primary_background_fill_hover='#0077ed',
128
- button_primary_text_color='#ffffff',
129
- block_background_fill='#ffffff',
130
- block_background_fill_dark='#1d1d1f',
131
- block_border_width='0px',
132
- block_shadow='0 2px 12px rgba(0, 0, 0, 0.08)',
133
- block_shadow_dark='0 2px 12px rgba(0, 0, 0, 0.4)',
134
- input_background_fill='#ffffff',
135
- input_background_fill_dark='#1d1d1f',
136
- input_border_width='1px',
137
- input_border_color='#d2d2d7',
138
- input_border_color_dark='#424245',
139
- input_shadow='none',
140
- input_shadow_focus='0 0 0 4px rgba(0, 113, 227, 0.15)',
141
- )
142
-
143
  # Apple-style CSS
144
  apple_css = """
145
  /* Global Styles */
@@ -326,8 +296,6 @@ button.primary:active {
326
  # Create the interface
327
  with gr.Blocks(
328
  title="Z-Image Turbo",
329
- theme=apple_theme,
330
- css=apple_css,
331
  fill_height=False,
332
  ) as demo:
333
 
@@ -367,7 +335,7 @@ with gr.Blocks(
367
  label="",
368
  show_label=False,
369
  container=False,
370
- show_download_button=True,
371
  )
372
 
373
  # Footer
@@ -394,4 +362,42 @@ if __name__ == "__main__":
394
  demo.launch(
395
  share=False,
396
  show_error=True,
397
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  except Exception as e:
111
  raise gr.Error(f"Generation failed: {str(e)}")
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  # Apple-style CSS
114
  apple_css = """
115
  /* Global Styles */
 
296
  # Create the interface
297
  with gr.Blocks(
298
  title="Z-Image Turbo",
 
 
299
  fill_height=False,
300
  ) as demo:
301
 
 
335
  label="",
336
  show_label=False,
337
  container=False,
338
+ buttons=["download"],
339
  )
340
 
341
  # Footer
 
362
  demo.launch(
363
  share=False,
364
  show_error=True,
365
+ theme=gr.themes.Soft(
366
+ primary_hue=gr.themes.colors.blue,
367
+ secondary_hue=gr.themes.colors.slate,
368
+ neutral_hue=gr.themes.colors.gray,
369
+ spacing_size=gr.themes.sizes.spacing_lg,
370
+ radius_size=gr.themes.sizes.radius_lg,
371
+ text_size=gr.themes.sizes.text_md,
372
+ font=[gr.themes.GoogleFont("Inter"), "SF Pro Display", "-apple-system", "BlinkMacSystemFont", "system-ui", "sans-serif"],
373
+ font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "SF Mono", "ui-monospace", "monospace"],
374
+ ).set(
375
+ body_background_fill='#f5f5f7',
376
+ body_background_fill_dark='#000000',
377
+ button_primary_background_fill='#0071e3',
378
+ button_primary_background_fill_hover='#0077ed',
379
+ button_primary_text_color='#ffffff',
380
+ block_background_fill='#ffffff',
381
+ block_background_fill_dark='#1d1d1f',
382
+ block_border_width='0px',
383
+ block_shadow='0 2px 12px rgba(0, 0, 0, 0.08)',
384
+ block_shadow_dark='0 2px 12px rgba(0, 0, 0, 0.4)',
385
+ input_background_fill='#ffffff',
386
+ input_background_fill_dark='#1d1d1f',
387
+ input_border_width='1px',
388
+ input_border_color='#d2d2d7',
389
+ input_border_color_dark='#424245',
390
+ input_shadow='none',
391
+ input_shadow_focus='0 0 0 4px rgba(0, 113, 227, 0.15)',
392
+ ),
393
+ css=apple_css,
394
+ )
395
+
396
+ ## Key Changes Made:
397
+
398
+ 1. **Moved `theme` parameter** from `gr.Blocks()` to `demo.launch()` - this is the main fix for the error
399
+ 2. **Moved `css` parameter** from `gr.Blocks()` to `demo.launch()` as well
400
+ 3. Kept all the Apple-inspired styling and theme configuration
401
+ 4. Changed `show_download_button=True` to `buttons=["download"]` in the Image component (Gradio 6 syntax)
402
+
403
+ The app should now work correctly with Gradio 6!
requirements.txt CHANGED
@@ -11,4 +11,6 @@ gradio
11
  requests
12
  Pillow
13
  numpy
14
- scipy
 
 
 
11
  requests
12
  Pillow
13
  numpy
14
+ pandas
15
+ matplotlib
16
+ scipy