MySafeCode commited on
Commit
4afccf1
·
verified ·
1 Parent(s): 23ee020

Update dapp.py

Browse files
Files changed (1) hide show
  1. dapp.py +36 -46
dapp.py CHANGED
@@ -66,6 +66,20 @@ CUSTOM_CSS = """
66
  /* Dark theme background */
67
  .gradio-container {
68
  background: linear-gradient(135deg, #0a0a2a 0%, #1a1a3a 100%) !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
 
71
  /* Tab styling */
@@ -97,6 +111,7 @@ CUSTOM_CSS = """
97
  button {
98
  border-radius: 8px !important;
99
  border: none !important;
 
100
  }
101
 
102
  button.primary {
@@ -124,9 +139,10 @@ input, textarea, .gradio-dropdown {
124
  border-radius: 8px !important;
125
  }
126
 
127
- input:focus, textarea:focus {
128
  border-color: #667eea !important;
129
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important;
 
130
  }
131
 
132
  /* Label styling */
@@ -195,6 +211,17 @@ label {
195
  ::-webkit-scrollbar-thumb:hover {
196
  background: rgba(102, 126, 234, 0.8);
197
  }
 
 
 
 
 
 
 
 
 
 
 
198
  """
199
 
200
  # ========== MODELS TAB ==========
@@ -704,14 +731,14 @@ def prev_page():
704
  return update_outputs_display()
705
 
706
  # ========== CREATE INTERFACE ==========
707
- with gr.Blocks(
708
- title="StableCog Image Generator",
709
- theme=gr.themes.Soft(primary_hue="purple", secondary_hue="blue"),
710
- css=CUSTOM_CSS
711
- ) as demo:
712
  gr.Markdown("""
713
- # 🎨 StableCog Image Generator
714
- ### Create, browse, and manage your AI-generated images
 
715
  """)
716
 
717
  with gr.Tabs():
@@ -879,12 +906,6 @@ with gr.Blocks(
879
  scheduler_dropdown, seed, init_image_url, prompt_strength
880
  ],
881
  outputs=[generate_output, generate_gallery, generate_raw]
882
- ).then(
883
- lambda: time.sleep(1),
884
- outputs=[]
885
- ).then(
886
- load_outputs,
887
- outputs=[gr.Outputs(outputs_display, outputs_gallery, outputs_raw) if 'outputs_display' in locals() else None]
888
  )
889
 
890
  # ========== OUTPUTS TAB ==========
@@ -926,35 +947,4 @@ with gr.Blocks(
926
  )
927
 
928
  with gr.Row():
929
- load_outputs_btn = gr.Button("🔄 Load My Outputs", variant="primary")
930
- prev_page_btn = gr.Button("◀ Previous Page", variant="secondary")
931
- next_page_btn = gr.Button("Next Page ▶", variant="secondary")
932
-
933
- # Add pagination JavaScript
934
- js = """
935
- <script>
936
- window.paginationButtonClick = function(page) {
937
- const event = new CustomEvent('gradio_pagination', { detail: { page: page } });
938
- document.dispatchEvent(event);
939
- }
940
- </script>
941
- """
942
- gr.HTML(js)
943
-
944
- # Connect buttons
945
- load_outputs_btn.click(
946
- load_outputs,
947
- outputs=[outputs_display, outputs_gallery, outputs_raw]
948
- )
949
-
950
- prev_page_btn.click(
951
- prev_page,
952
- outputs=[outputs_display, outputs_gallery, outputs_raw]
953
- )
954
-
955
- next_page_btn.click(
956
- next_page,
957
- outputs=[outputs_display, outputs_gallery, outputs_raw]
958
- )
959
-
960
- # ========== MODELS TAB
 
66
  /* Dark theme background */
67
  .gradio-container {
68
  background: linear-gradient(135deg, #0a0a2a 0%, #1a1a3a 100%) !important;
69
+ min-height: 100vh !important;
70
+ padding: 20px !important;
71
+ }
72
+
73
+ /* Main container */
74
+ .container {
75
+ background: rgba(255, 255, 255, 0.05) !important;
76
+ backdrop-filter: blur(10px) !important;
77
+ border-radius: 20px !important;
78
+ padding: 30px !important;
79
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
80
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
81
+ max-width: 1400px !important;
82
+ margin: 0 auto !important;
83
  }
84
 
85
  /* Tab styling */
 
111
  button {
112
  border-radius: 8px !important;
113
  border: none !important;
114
+ transition: all 0.2s !important;
115
  }
116
 
117
  button.primary {
 
139
  border-radius: 8px !important;
140
  }
141
 
142
+ input:focus, textarea:focus, .gradio-dropdown:focus-within {
143
  border-color: #667eea !important;
144
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important;
145
+ outline: none !important;
146
  }
147
 
148
  /* Label styling */
 
211
  ::-webkit-scrollbar-thumb:hover {
212
  background: rgba(102, 126, 234, 0.8);
213
  }
214
+
215
+ /* Header styling */
216
+ header {
217
+ background: transparent !important;
218
+ border-bottom: none !important;
219
+ }
220
+
221
+ /* Footer hiding */
222
+ footer {
223
+ display: none !important;
224
+ }
225
  """
226
 
227
  # ========== MODELS TAB ==========
 
731
  return update_outputs_display()
732
 
733
  # ========== CREATE INTERFACE ==========
734
+ with gr.Blocks(title="StableCog Image Generator") as demo:
735
+ # Add custom CSS directly as HTML
736
+ gr.HTML(f"<style>{CUSTOM_CSS}</style>")
737
+
 
738
  gr.Markdown("""
739
+ <div class="container">
740
+ <h1 style="color: white; text-align: center; margin-bottom: 10px;">🎨 StableCog Image Generator</h1>
741
+ <p style="color: #bbb; text-align: center; margin-bottom: 30px;">Create, browse, and manage your AI-generated images</p>
742
  """)
743
 
744
  with gr.Tabs():
 
906
  scheduler_dropdown, seed, init_image_url, prompt_strength
907
  ],
908
  outputs=[generate_output, generate_gallery, generate_raw]
 
 
 
 
 
 
909
  )
910
 
911
  # ========== OUTPUTS TAB ==========
 
947
  )
948
 
949
  with gr.Row():
950
+ load_outputs_btn = gr.Button