DawnC commited on
Commit
b62df99
·
verified ·
1 Parent(s): 0377514

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -144,7 +144,7 @@ def process_and_plot(image, model_name, confidence_threshold, filter_classes=Non
144
  return result_image, result_text, formatted_stats, plot_figure, scene_desc, activities_data, safety_data, zones, lighting_conditions
145
 
146
  except Exception as e:
147
- # 添加錯誤處理,確保即使出錯也能返回有效的數據
148
  import traceback
149
  error_msg = f"Error processing image: {str(e)}\n{traceback.format_exc()}"
150
  print(error_msg)
@@ -161,7 +161,7 @@ def process_and_plot(image, model_name, confidence_threshold, filter_classes=Non
161
  return None, error_msg, "{}", fig, "Error processing image", [["No activities"]], [["No safety concerns"]], {}, {"time_of_day": "unknown", "confidence": 0}
162
 
163
  def create_interface():
164
- """創建 Gradio 界面,包含美化的視覺效果"""
165
  css = Style.get_css()
166
 
167
  # 獲取可用模型信息
@@ -423,11 +423,21 @@ def create_interface():
423
  cache_examples=False,
424
  )
425
 
 
426
  # Footer
427
  gr.HTML("""
428
- <div class="footer">
429
- <p>Powered by YOLOv8 and Ultralytics • Created with Gradio</p>
430
- <p>Model can detect 80 different classes of objects</p>
 
 
 
 
 
 
 
 
 
431
  </div>
432
  """)
433
 
 
144
  return result_image, result_text, formatted_stats, plot_figure, scene_desc, activities_data, safety_data, zones, lighting_conditions
145
 
146
  except Exception as e:
147
+ # 確保即使出錯也能返回有效的數據
148
  import traceback
149
  error_msg = f"Error processing image: {str(e)}\n{traceback.format_exc()}"
150
  print(error_msg)
 
161
  return None, error_msg, "{}", fig, "Error processing image", [["No activities"]], [["No safety concerns"]], {}, {"time_of_day": "unknown", "confidence": 0}
162
 
163
  def create_interface():
164
+ """創建 Gradio 界面"""
165
  css = Style.get_css()
166
 
167
  # 獲取可用模型信息
 
423
  cache_examples=False,
424
  )
425
 
426
+
427
  # Footer
428
  gr.HTML("""
429
+ <div class="footer" style="padding: 25px 0; text-align: center; background: linear-gradient(to right, #f5f9fc, #e1f5fe); border-top: 1px solid #e2e8f0; margin-top: 30px;">
430
+ <div style="margin-bottom: 15px;">
431
+ <p style="font-size: 14px; color: #4A5568; margin: 5px 0;">Powered by YOLOv8, CLIP and Ultralytics Created with Gradio</p>
432
+ <p style="font-size: 14px; color: #4A5568; margin: 5px 0;">Model can detect 80 different classes of objects</p>
433
+ </div>
434
+
435
+ <div style="display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 15px;">
436
+ <p style="font-family: 'Arial', sans-serif; font-size: 14px; font-weight: 500; letter-spacing: 2px; background: linear-gradient(90deg, #38b2ac, #4299e1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0; text-transform: uppercase; display: inline-block;">EXPLORE THE CODE →</p>
437
+ <a href="https://github.com/Eric-Chung-0511/Learning-Record/tree/main/Data%20Science%20Projects/VisionScout" style="text-decoration: none;">
438
+ <img src="https://img.shields.io/badge/GitHub-VisionScout-4299e1?logo=github&style=for-the-badge">
439
+ </a>
440
+ </div>
441
  </div>
442
  """)
443