stshanks commited on
Commit
74db6a6
·
verified ·
1 Parent(s): 4f63229

Update app.py

Browse files

error fix for custom theme

Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -65,15 +65,14 @@ def predict_text(image):
65
  with open("style.css", "r") as f:
66
  custom_css = f.read()
67
 
68
- # Create a custom Gradio theme using the external CSS
69
- custom_theme = gr.themes.Base(
70
  font=["Arial", "sans-serif"],
71
- primary_hue="#e2cb92", # GWU official gold as primary color
72
- css=custom_css
73
  )
74
 
75
- # Gradio UI
76
- with gr.Blocks(theme=custom_theme) as interface:
77
 
78
  # Header
79
  gr.Markdown(
@@ -102,6 +101,5 @@ with gr.Blocks(theme=custom_theme) as interface:
102
  submit_button.click(fn=predict_text, inputs=image_input, outputs=output_text)
103
 
104
 
105
-
106
  if __name__ == "__main__":
107
  interface.launch()
 
65
  with open("style.css", "r") as f:
66
  custom_css = f.read()
67
 
68
+ # Create a base theme (without custom CSS)
69
+ theme_obj = gr.themes.Base(
70
  font=["Arial", "sans-serif"],
71
+ primary_hue="#e2cb92" # GWU official gold as primary color
 
72
  )
73
 
74
+ # Build Gradio interface with custom CSS applied via the Blocks css parameter
75
+ with gr.Blocks(theme=theme_obj, css=custom_css) as interface:
76
 
77
  # Header
78
  gr.Markdown(
 
101
  submit_button.click(fn=predict_text, inputs=image_input, outputs=output_text)
102
 
103
 
 
104
  if __name__ == "__main__":
105
  interface.launch()