Diggz10 commited on
Commit
3d49fbf
·
verified ·
1 Parent(s): ea56e06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -13,6 +13,20 @@ import lpips
13
  from facenet_pytorch import MTCNN
14
  import legacy
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  # --- Load All Models ---
17
  print("Loading all models...")
18
  device = torch.device("cpu")
@@ -84,7 +98,7 @@ def edit_uploaded_face(uploaded_image, strength, progress=gr.Progress(track_tqdm
84
  print("Processing complete.")
85
  return img_out
86
 
87
- # Use .queue() and the standard .launch(). This enables the API.
88
  gr.Interface(
89
  fn=edit_uploaded_face,
90
  inputs=[
@@ -92,7 +106,7 @@ gr.Interface(
92
  gr.Slider(-5, 5, step=0.1, value=0, label="Gender Strength (← Feminine | Masculine →)")
93
  ],
94
  outputs=gr.Image(label="Edited Face"),
 
95
  title="Face Editor Backend",
96
- description="This engine detects a face in the uploaded image, then edits its gender expression. It is ready to be used as an API.",
97
- flagging_options=None,
98
  ).queue().launch()
 
13
  from facenet_pytorch import MTCNN
14
  import legacy
15
 
16
+ # --- THEME DEFINITION ---
17
+ # This theme uses the colors and fonts from your website's CSS.
18
+ theme = gr.themes.Base(
19
+ primary_hue=gr.themes.colors.blue, # A base blue hue
20
+ font=[gr.themes.GoogleFont("Poppins"), "sans-serif"],
21
+ ).set(
22
+ button_primary_background_fill="#4A90E2", # Your --primary-color
23
+ button_primary_background_fill_hover="#357ABD", # Your --secondary-color
24
+ slider_color="#4A90E2", # Your --slider-thumb color
25
+ slider_color_dark="#4A90E2"
26
+ )
27
+ # -------------------------
28
+
29
+
30
  # --- Load All Models ---
31
  print("Loading all models...")
32
  device = torch.device("cpu")
 
98
  print("Processing complete.")
99
  return img_out
100
 
101
+ # Create the Gradio Interface with the custom theme
102
  gr.Interface(
103
  fn=edit_uploaded_face,
104
  inputs=[
 
106
  gr.Slider(-5, 5, step=0.1, value=0, label="Gender Strength (← Feminine | Masculine →)")
107
  ],
108
  outputs=gr.Image(label="Edited Face"),
109
+ theme=theme, # <--- APPLYING YOUR CUSTOM THEME
110
  title="Face Editor Backend",
111
+ description="This engine detects a face in the uploaded image, then edits its gender expression.",
 
112
  ).queue().launch()