broadfield-dev commited on
Commit
ff06f44
·
verified ·
1 Parent(s): 03baf02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +84 -1
app.py CHANGED
@@ -780,7 +780,90 @@ def handle_refresh_space_status(hf_api_key_ui, ui_owner_name, ui_space_name):
780
  yield _status_display_md
781
 
782
 
783
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="orange")) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
784
  gr.Markdown("# 🤖 AI Code & Space Generator")
785
  gr.Markdown("Configure settings, chat with AI to generate/modify Hugging Face Spaces, then build, preview, and edit.")
786
  with gr.Row():
 
780
  yield _status_display_md
781
 
782
 
783
+ # Define a custom theme with a dark background and contrasting colors
784
+ # And add custom CSS for a background gradient and component styling
785
+ custom_theme = gr.themes.Base(
786
+ primary_hue="teal", # Teal for primary actions
787
+ secondary_hue="purple", # Purple for secondary elements
788
+ neutral_hue="zinc", # Zinc for neutral/backgrounds (dark gray)
789
+ text_size="sm", # Smaller text size for a denser, professional look
790
+ spacing_size="md", # Medium spacing
791
+ radius_size="sm", # Small border radius
792
+ font=["System UI", "sans-serif"] # Use system font
793
+ )
794
+
795
+ custom_css = """
796
+ body {
797
+ background: linear-gradient(to bottom right, #2c3e50, #34495e); /* Dark blue-gray gradient */
798
+ color: #ecf0f1; /* Light text color for dark background */
799
+ }
800
+ /* Adjust main Gradio container background to be transparent to see body gradient */
801
+ .gradio-container {
802
+ background: transparent !important;
803
+ }
804
+ /* Adjust component backgrounds for contrast against the body gradient */
805
+ .gr-box, .gr-panel, .gr-pill {
806
+ background-color: rgba(44, 62, 80, 0.8) !important; /* Slightly lighter transparent dark blue-gray */
807
+ border-color: rgba(189, 195, 199, 0.2) !important; /* Light border for contrast */
808
+ }
809
+ /* Adjust inputs, dropdowns, buttons etc. for visibility */
810
+ .gr-textbox, .gr-dropdown, .gr-button, .gr-code, .gr-chat-message {
811
+ border-color: rgba(189, 195, 199, 0.3) !important;
812
+ background-color: rgba(52, 73, 94, 0.9) !important; /* Slightly different dark blue-gray */
813
+ color: #ecf0f1 !important; /* Ensure text is light */
814
+ }
815
+ .gr-button.gr-button-primary {
816
+ background-color: #1abc9c !important; /* Teal from primary_hue */
817
+ color: white !important;
818
+ border-color: #16a085 !important;
819
+ }
820
+ .gr-button.gr-button-secondary {
821
+ background-color: #9b59b6 !important; /* Purple from secondary_hue */
822
+ color: white !important;
823
+ border-color: #8e44ad !important;
824
+ }
825
+ .gr-button.gr-button-stop {
826
+ background-color: #e74c3c !important; /* Red for stop/delete */
827
+ color: white !important;
828
+ border-color: #c0392b !important;
829
+ }
830
+ /* Adjust markdown backgrounds */
831
+ .gr-markdown {
832
+ background-color: rgba(44, 62, 80, 0.7) !important; /* Transparent dark background */
833
+ padding: 10px; /* Add some padding */
834
+ border-radius: 5px; /* Rounded corners */
835
+ }
836
+ /* Style markdown headers for better contrast */
837
+ .gr-markdown h1, .gr-markdown h2, .gr-markdown h3, .gr-markdown h4, .gr-markdown h5, .gr-markdown h6 {
838
+ color: #ecf0f1 !important; /* Ensure headers are light */
839
+ border-bottom-color: rgba(189, 195, 199, 0.3) !important; /* Light separator */
840
+ }
841
+ /* Style code blocks within markdown */
842
+ .gr-markdown pre code {
843
+ background-color: rgba(52, 73, 94, 0.95) !important; /* Darker code background */
844
+ border-color: rgba(189, 195, 199, 0.3) !important;
845
+ }
846
+
847
+ /* Chatbot specific styling */
848
+ .gr-chatbot {
849
+ background-color: rgba(44, 62, 80, 0.7) !important;
850
+ border-color: rgba(189, 195, 199, 0.2) !important;
851
+ }
852
+ .gr-chatbot .message {
853
+ background-color: rgba(52, 73, 94, 0.9) !important; /* Dark background for messages */
854
+ color: #ecf0f1 !important;
855
+ border-color: rgba(189, 195, 199, 0.3) !important;
856
+ }
857
+ .gr-chatbot .message.user {
858
+ background-color: rgba(46, 204, 113, 0.9) !important; /* Greenish background for user messages */
859
+ color: black !important; /* Dark text for green background */
860
+ }
861
+
862
+
863
+ """
864
+
865
+
866
+ with gr.Blocks(theme=custom_theme, css=custom_css) as demo:
867
  gr.Markdown("# 🤖 AI Code & Space Generator")
868
  gr.Markdown("Configure settings, chat with AI to generate/modify Hugging Face Spaces, then build, preview, and edit.")
869
  with gr.Row():