iammraat commited on
Commit
72111eb
Β·
verified Β·
1 Parent(s): 870ba36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -5
app.py CHANGED
@@ -6,13 +6,24 @@ import logging
6
  import os
7
  from datetime import datetime
8
 
9
- # ── Quiet startup ───────────────────────────────────────────────────────
 
 
 
 
 
 
 
 
 
10
  os.environ['HF_HUB_DISABLE_PROGRESS_BARS'] = '1'
11
  logging.getLogger('ultralytics').setLevel(logging.WARNING)
12
 
 
13
  logging.basicConfig(
14
  level=logging.INFO,
15
- format='%(asctime)s | %(level)-5s | %(message)s'
 
16
  )
17
  logger = logging.getLogger(__name__)
18
 
@@ -152,6 +163,8 @@ def visualize_regions(
152
  return debug_img, "\n".join(logs)
153
 
154
 
 
 
155
  demo = gr.Interface(
156
  fn=visualize_regions,
157
  inputs=[
@@ -175,10 +188,30 @@ demo = gr.Interface(
175
  "β€’ Use logs to see exact confidences and sizes\n"
176
  "β€’ Save crops if you want to manually check what is being detected"
177
  ),
178
- theme=gr.themes.Soft(),
179
- allow_flagging="never",
180
  )
181
 
182
  if __name__ == "__main__":
183
  logger.info("Launching debug interface...")
184
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  import os
7
  from datetime import datetime
8
 
9
+ # # ── Quiet startup ───────────────────────────────────────────────────────
10
+ # os.environ['HF_HUB_DISABLE_PROGRESS_BARS'] = '1'
11
+ # logging.getLogger('ultralytics').setLevel(logging.WARNING)
12
+
13
+ # logging.basicConfig(
14
+ # level=logging.INFO,
15
+ # format='%(asctime)s | %(level)-5s | %(message)s'
16
+ # )
17
+ # logger = logging.getLogger(__name__)
18
+
19
  os.environ['HF_HUB_DISABLE_PROGRESS_BARS'] = '1'
20
  logging.getLogger('ultralytics').setLevel(logging.WARNING)
21
 
22
+ # FIXED logging format: use levelname, not level
23
  logging.basicConfig(
24
  level=logging.INFO,
25
+ format='%(asctime)s | %(levelname)-5s | %(message)s', # ← changed level β†’ levelname
26
+ datefmt='%Y-%m-%d %H:%M:%S'
27
  )
28
  logger = logging.getLogger(__name__)
29
 
 
163
  return debug_img, "\n".join(logs)
164
 
165
 
166
+
167
+ # ── Gradio Interface ────────────────────────────────────────────────────
168
  demo = gr.Interface(
169
  fn=visualize_regions,
170
  inputs=[
 
188
  "β€’ Use logs to see exact confidences and sizes\n"
189
  "β€’ Save crops if you want to manually check what is being detected"
190
  ),
191
+ # theme=gr.themes.Soft(), # ← comment out or remove (moved to launch)
192
+ # allow_flagging="never", # ← remove this line completely
193
  )
194
 
195
  if __name__ == "__main__":
196
  logger.info("Launching debug interface...")
197
+ demo.launch(
198
+ theme=gr.themes.Soft(), # ← moved here
199
+ flagging_mode="never", # ← renamed + moved here (this is what you want)
200
+ # server_name="0.0.0.0", # optional, usually not needed on HF Spaces
201
+ # server_port=7860,
202
+ )
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+