Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -122,8 +122,6 @@ body { font-family: 'Inter', sans-serif; }
|
|
122 |
/* Ensure label text inside columns is readable */
|
123 |
#prediction-label .label-name { font-weight: bold; font-size: 1.1em; }
|
124 |
#prediction-label .confidence { font-size: 1em; }
|
125 |
-
/* Theme should make label text light, but force if needed: */
|
126 |
-
/* #prediction-label { color: #e5e7eb; } */
|
127 |
|
128 |
|
129 |
/* Footer styling */
|
@@ -145,17 +143,9 @@ body { font-family: 'Inter', sans-serif; }
|
|
145 |
"""
|
146 |
|
147 |
# --- Gradio Interface using Blocks and Theme ---
|
148 |
-
#
|
149 |
-
|
150 |
-
|
151 |
-
secondary_hue="blue",
|
152 |
-
neutral_hue="slate",
|
153 |
-
radius_size=gr.themes.sizes.radius_lg,
|
154 |
-
spacing_size=gr.themes.sizes.spacing_lg,
|
155 |
-
).dark() # <<< APPLY DARK MODE HERE
|
156 |
-
|
157 |
-
|
158 |
-
with gr.Blocks(theme=theme, css=css) as iface:
|
159 |
# Title and Description
|
160 |
gr.Markdown("# AI vs Human Image Detector", elem_id="app-title")
|
161 |
gr.Markdown(
|
@@ -165,7 +155,7 @@ with gr.Blocks(theme=theme, css=css) as iface:
|
|
165 |
)
|
166 |
|
167 |
# Main layout
|
168 |
-
with gr.Row(variant='panel'):
|
169 |
with gr.Column(scale=1, min_width=300, elem_id="input-column"):
|
170 |
image_input = gr.Image(
|
171 |
type="pil",
|
@@ -181,7 +171,6 @@ with gr.Blocks(theme=theme, css=css) as iface:
|
|
181 |
num_top_classes=2,
|
182 |
label="Classification",
|
183 |
elem_id="prediction-label"
|
184 |
-
# The theme should now correctly style the label text for dark mode
|
185 |
)
|
186 |
|
187 |
# Examples Section
|
@@ -193,18 +182,19 @@ with gr.Blocks(theme=theme, css=css) as iface:
|
|
193 |
fn=classify_image,
|
194 |
cache_examples=True,
|
195 |
label="✨ Click an Example to Try!"
|
196 |
-
# Examples appearance will also adapt to the dark theme
|
197 |
)
|
198 |
|
199 |
# Footer / Article section
|
200 |
-
# Removed explicit model ID formatting from Markdown string, use f-string
|
201 |
gr.Markdown(f"""
|
202 |
---
|
|
|
203 |
This application uses a fine-tuned [SigLIP](https://huggingface.co/docs/transformers/model_doc/siglip) vision model
|
204 |
specifically trained to differentiate between images generated by Artificial Intelligence and those created by humans.
|
205 |
|
206 |
-
|
|
|
207 |
|
|
|
208 |
Fine tuning code available at [https://exnrt.com/blog/ai/fine-tuning-siglip2/](https://exnrt.com/blog/ai/fine-tuning-siglip2/).
|
209 |
""",
|
210 |
elem_id="app-footer"
|
|
|
122 |
/* Ensure label text inside columns is readable */
|
123 |
#prediction-label .label-name { font-weight: bold; font-size: 1.1em; }
|
124 |
#prediction-label .confidence { font-size: 1em; }
|
|
|
|
|
125 |
|
126 |
|
127 |
/* Footer styling */
|
|
|
143 |
"""
|
144 |
|
145 |
# --- Gradio Interface using Blocks and Theme ---
|
146 |
+
# Use the theme string identifier for the dark mode variant
|
147 |
+
# Other options: "default/dark", "monochrome/dark", "glass/dark"
|
148 |
+
with gr.Blocks(theme="soft/dark", css=css) as iface: # <<< CHANGE IS HERE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
# Title and Description
|
150 |
gr.Markdown("# AI vs Human Image Detector", elem_id="app-title")
|
151 |
gr.Markdown(
|
|
|
155 |
)
|
156 |
|
157 |
# Main layout
|
158 |
+
with gr.Row(variant='panel'):
|
159 |
with gr.Column(scale=1, min_width=300, elem_id="input-column"):
|
160 |
image_input = gr.Image(
|
161 |
type="pil",
|
|
|
171 |
num_top_classes=2,
|
172 |
label="Classification",
|
173 |
elem_id="prediction-label"
|
|
|
174 |
)
|
175 |
|
176 |
# Examples Section
|
|
|
182 |
fn=classify_image,
|
183 |
cache_examples=True,
|
184 |
label="✨ Click an Example to Try!"
|
|
|
185 |
)
|
186 |
|
187 |
# Footer / Article section
|
|
|
188 |
gr.Markdown(f"""
|
189 |
---
|
190 |
+
**How it Works:**
|
191 |
This application uses a fine-tuned [SigLIP](https://huggingface.co/docs/transformers/model_doc/siglip) vision model
|
192 |
specifically trained to differentiate between images generated by Artificial Intelligence and those created by humans.
|
193 |
|
194 |
+
**Model:**
|
195 |
+
* You can find the model card here: <a href='https://huggingface.co/{MODEL_IDENTIFIER}' target='_blank'>{MODEL_IDENTIFIER}</a>
|
196 |
|
197 |
+
**Training Code:**
|
198 |
Fine tuning code available at [https://exnrt.com/blog/ai/fine-tuning-siglip2/](https://exnrt.com/blog/ai/fine-tuning-siglip2/).
|
199 |
""",
|
200 |
elem_id="app-footer"
|