add static web files

This commit is contained in:
2025-08-20 12:08:25 +08:00
parent 4b9374fcdc
commit 53e704e0bf
13 changed files with 236353 additions and 9 deletions
+5 -1
View File
@@ -1,9 +1,13 @@
import cv2
import os
from ultralytics import YOLO
def elements_recognition(img):
model = YOLO('../best_model/model_2.pt')
# 获取当前文件的目录,然后构建模型文件的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
model_path = os.path.join(current_dir, '../best_model/model_2.pt')
model = YOLO(model_path)
original = img
img = cv2.resize(original, (1000, int(original.shape[0] * 1000 / original.shape[1])))
results = model(img)[0]
+6 -5
View File
@@ -20,8 +20,8 @@ def generate_json(wires, components):
"单刀双掷开关": "switch",
"单刀单掷开关": "switch",
"灯泡": "lightBulb",
"电源": "BATTERY",
"电池电源": "BATTERY",
"电源": "battery",
"电池电源": "battery",
"电阻": "RESISTOR",
"黑盒电流表": "ammeter",
"螺线管": "solenoid"
@@ -89,7 +89,8 @@ def generate_json(wires, components):
elem["resistance"] = 10
elif label == "battery":
elem["voltage"] = 9
elem["batterType"] = "BATTERRY"
elem["type"] = "battery"
elem["batteryType"] = "BATTERY"
elem["internalResistance"] = 0.01
elif label == "resistor":
elem["resistorType"] = "RESISTOR"
@@ -187,8 +188,8 @@ def visualize_wires_and_components(image, results, components):
"单刀双掷开关": "switch",
"单刀单掷开关": "switch",
"灯泡":"lightBulb",
"电源": "BATTERY",
"电池电源": "BATTERY",
"电源": "battery",
"电池电源": "battery",
"电阻": "RESISTOR",
"黑盒电流表": "ammeter",
"螺线管": "solenoid"
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1364
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+ARIA 1.0//EN" "http://www.w3.org/WAI/ARIA/schemata/xhtml-aria-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1"/>
<meta name="mobile-web-app-capable" content="yes"/>
<meta name="phet-sim-level" content="production"/>
<title>&#8234;Circuit Construction Kit: DC - Virtual Lab&#8236;</title>
</head>
<!--
‪Circuit Construction Kit: DC - Virtual Lab‬ 1.5.0-dev.0
Copyright 2002-2025, Regents of the University of Colorado
PhET Interactive Simulations, University of Colorado Boulder
This file is licensed under Creative Commons Attribution 4.0
For alternate source code licensing, see https://github.com/phetsims
For licenses for third-party software used by this simulation, see below
For more information, see https://phet.colorado.edu/en/licensing/html
The PhET name and PhET logo are registered trademarks of The Regents of the
University of Colorado. Permission is granted to use the PhET name and PhET logo
only for attribution purposes. Use of the PhET name and/or PhET logo for promotional,
marketing, or advertising purposes requires a separate license agreement from the
University of Colorado. Contact phethelp@colorado.edu regarding licensing.
-->
<!-- body is only made black for the loading phase so that the splash screen is black -->
<body style="background-color:black;">
<script type="text/javascript" src="circuit-construction-kit-dc-virtual-lab_license_adapted-from-phet.js" charset="utf-8"></script><script type="text/javascript" src="circuit-construction-kit-dc-virtual-lab_initialization_adapted-from-phet.js" charset="utf-8"></script>
<script type="text/javascript" src="circuit-construction-kit-dc-virtual-lab_adapted-from-phet.js" charset="utf-8"></script>
</body>
</html>
File diff suppressed because one or more lines are too long