Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
edge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
成恩 伍
edge
Commits
e4eac73f
Commit
e4eac73f
authored
2 years ago
by
wce
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
1e45c6c3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.idea/workspace.xml
+28
-16
28 additions, 16 deletions
.idea/workspace.xml
README.md
+1
-1
1 addition, 1 deletion
README.md
app.py
+31
-24
31 additions, 24 deletions
app.py
with
60 additions
and
41 deletions
.idea/workspace.xml
+
28
−
16
View file @
e4eac73f
...
...
@@ -3,6 +3,7 @@
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"568b48a6-ca7f-4dc8-b0ca-a3d09f437fa9"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/README.md"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/README.md"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app.py"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
...
@@ -37,7 +38,7 @@
<recent
name=
"D:\大三下\iot\作业\大作业\edge"
/>
</key>
</component>
<component
name=
"RunManager"
selected=
"Python.
app
"
>
<component
name=
"RunManager"
selected=
"Python.
test (1)
"
>
<configuration
name=
"app"
type=
"PythonConfigurationType"
factoryName=
"Python"
temporary=
"true"
nameIsGenerated=
"true"
>
<module
name=
"edge"
/>
<option
name=
"INTERPRETER_OPTIONS"
value=
""
/>
...
...
@@ -162,7 +163,14 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1656315889671
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"7"
/>
<task
id=
"LOCAL-00007"
summary=
"update"
>
<created>
1656318119843
</created>
<option
name=
"number"
value=
"00007"
/>
<option
name=
"presentableId"
value=
"LOCAL-00007"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1656318119843
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"8"
/>
<servers
/>
</component>
<component
name=
"VcsManagerConfiguration"
>
...
...
@@ -173,51 +181,55 @@
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"update"
/>
</component>
<component
name=
"WindowStateProjectService"
>
<state
x=
"409"
y=
"6"
key=
"CommitChangelistDialog2"
timestamp=
"16563181
04200
"
>
<state
x=
"409"
y=
"6"
key=
"CommitChangelistDialog2"
timestamp=
"16563181
19399
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
x=
"409"
y=
"6"
key=
"CommitChangelistDialog2/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656176204394"
/>
<state
x=
"409"
y=
"6"
key=
"CommitChangelistDialog2/0.0.1536.824@0.0.1536.824"
timestamp=
"16563181
04200
"
/>
<state
x=
"409"
y=
"6"
key=
"CommitChangelistDialog2/0.0.1536.824@0.0.1536.824"
timestamp=
"16563181
19399
"
/>
<state
x=
"549"
y=
"167"
key=
"FileChooserDialogImpl"
timestamp=
"1656170973860"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
x=
"549"
y=
"167"
key=
"FileChooserDialogImpl/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656170973860"
/>
<state
width=
"1515"
height=
"
288
"
key=
"GridCell.Tab.0.bottom"
timestamp=
"16563
1802952
2"
>
<state
width=
"1515"
height=
"
176
"
key=
"GridCell.Tab.0.bottom"
timestamp=
"16563
2049340
2"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1515"
height=
"259"
key=
"GridCell.Tab.0.bottom/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656276357461"
/>
<state
width=
"1515"
height=
"
288
"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"16563
1802952
2"
/>
<state
width=
"1515"
height=
"
288
"
key=
"GridCell.Tab.0.center"
timestamp=
"16563
1802952
2"
>
<state
width=
"1515"
height=
"
176
"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"16563
2049340
2"
/>
<state
width=
"1515"
height=
"
176
"
key=
"GridCell.Tab.0.center"
timestamp=
"16563
2049340
2"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1515"
height=
"259"
key=
"GridCell.Tab.0.center/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656276357461"
/>
<state
width=
"1515"
height=
"
288
"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"16563
1802952
2"
/>
<state
width=
"1515"
height=
"
288
"
key=
"GridCell.Tab.0.left"
timestamp=
"16563
18029522
"
>
<state
width=
"1515"
height=
"
176
"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"16563
2049340
2"
/>
<state
width=
"1515"
height=
"
176
"
key=
"GridCell.Tab.0.left"
timestamp=
"16563
20493401
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1515"
height=
"259"
key=
"GridCell.Tab.0.left/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656276357461"
/>
<state
width=
"1515"
height=
"
288
"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"16563
18029522
"
/>
<state
width=
"1515"
height=
"
288
"
key=
"GridCell.Tab.0.right"
timestamp=
"16563
1802952
2"
>
<state
width=
"1515"
height=
"
176
"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"16563
20493401
"
/>
<state
width=
"1515"
height=
"
176
"
key=
"GridCell.Tab.0.right"
timestamp=
"16563
2049340
2"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1515"
height=
"259"
key=
"GridCell.Tab.0.right/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656276357461"
/>
<state
width=
"1515"
height=
"
288
"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"16563
1802952
2"
/>
<state
width=
"1515"
height=
"
261
"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1656
276357457
"
>
<state
width=
"1515"
height=
"
176
"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"16563
2049340
2"
/>
<state
width=
"1515"
height=
"
127
"
key=
"GridCell.Tab.1.bottom"
timestamp=
"1656
319838671
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1515"
height=
"261"
key=
"GridCell.Tab.1.bottom/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656276357457"
/>
<state
width=
"1515"
height=
"261"
key=
"GridCell.Tab.1.center"
timestamp=
"1656276357457"
>
<state
width=
"1515"
height=
"127"
key=
"GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1656319838671"
/>
<state
width=
"1515"
height=
"127"
key=
"GridCell.Tab.1.center"
timestamp=
"1656319838671"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1515"
height=
"261"
key=
"GridCell.Tab.1.center/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656276357457"
/>
<state
width=
"1515"
height=
"261"
key=
"GridCell.Tab.1.left"
timestamp=
"1656276357457"
>
<state
width=
"1515"
height=
"127"
key=
"GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1656319838671"
/>
<state
width=
"1515"
height=
"127"
key=
"GridCell.Tab.1.left"
timestamp=
"1656319838670"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1515"
height=
"261"
key=
"GridCell.Tab.1.left/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656276357457"
/>
<state
width=
"1515"
height=
"261"
key=
"GridCell.Tab.1.right"
timestamp=
"1656276357457"
>
<state
width=
"1515"
height=
"127"
key=
"GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1656319838670"
/>
<state
width=
"1515"
height=
"127"
key=
"GridCell.Tab.1.right"
timestamp=
"1656319838671"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"1515"
height=
"261"
key=
"GridCell.Tab.1.right/0.0.1536.824/1920.0.1920.1040@0.0.1536.824"
timestamp=
"1656276357457"
/>
<state
width=
"1515"
height=
"127"
key=
"GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1656319838671"
/>
<state
x=
"270"
y=
"54"
key=
"SettingsEditor"
timestamp=
"1656170734965"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
...
...
This diff is collapsed.
Click to expand it.
README.md
+
1
−
1
View file @
e4eac73f
...
...
@@ -3,7 +3,7 @@
+
docker rm edge
+
docker rmi edge
+
docker build -t edge .
+
docker run -d -p 7001:7001
-v /home/image:/test
--name edge edge
+
docker run -d -p 7001:7001 --name edge edge
### 生成requirements.txt
+
pipreqs ./ --encoding=utf8 --force
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app.py
+
31
−
24
View file @
e4eac73f
import
threading
from
flask
import
Flask
,
request
from
paho.mqtt
import
client
as
mqtt_client
import
requests
...
...
@@ -11,35 +13,36 @@ import numpy as np
app
=
Flask
(
__name__
)
# 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
auth
=
oss2
.
Auth
(
'
LTAI5tB6og9RLGfY8dfVXSKV
'
,
'
NfHYGBBzZhUDZACPq6ghX0sPcLSGxO
'
)
# yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
# 填写Bucket名称。
bucket
=
oss2
.
Bucket
(
auth
,
'
oss-cn-nanjing.aliyuncs.com
'
,
'
collect-191250
'
)
# # 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
# auth = oss2.Auth('LTAI5tB6og9RLGfY8dfVXSKV', 'NfHYGBBzZhUDZACPq6ghX0sPcLSGxO')
# # yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
# # 填写Bucket名称。
# bucket = oss2.Bucket(auth, 'oss-cn-nanjing.aliyuncs.com', 'collect-191250')
broker
=
"
114.116.217.108
"
port
=
1883
nameTopic
=
"
incoming/data/camera/nameList
"
picTopic
=
"
incoming/data/camera/picBase64
"
client_id
=
'
python-mqtt-lzj
'
def
publish
(
topic
,
value
):
broker
=
"
114.116.217.108
"
port
=
1883
client_id
=
'
python-mqtt-lzj
'
def
connect_mqtt
():
def
on_connect
(
client
,
userdata
,
flags
,
rc
):
if
rc
==
0
:
print
(
"
Connected to MQTT Broker!
"
)
else
:
print
(
"
Failed to connect, return code %d
\n
"
,
rc
)
def
connect_mqtt
():
def
on_connect
(
client
,
userdata
,
flags
,
rc
):
if
rc
==
0
:
print
(
"
Connected to MQTT Broker!
"
)
else
:
print
(
"
Failed to connect, return code %d
\n
"
,
rc
)
# Set Connecting Client ID
client1
=
mqtt_client
.
Client
(
client_id
)
client1
.
on_connect
=
on_connect
client1
.
connect
(
broker
,
port
)
return
client1
# Set Connecting Client ID
client
=
mqtt_client
.
Client
(
client_id
)
client
.
on_connect
=
on_connect
client
.
connect
(
broker
,
port
)
return
client
client
=
connect_mqtt
()
client
.
publish
(
topic
,
str
(
value
))
client
=
connect_mqtt
()
# def base64_2_image(base64_encode):
...
...
@@ -79,11 +82,15 @@ def getCamera():
@app.route
(
"
/camera/update
"
,
methods
=
[
"
POST
"
])
def
cameraUpdate
():
data
=
request
.
json
nameList
=
data
[
'
nameList
'
]
status
=
client
.
publish
(
"
incoming/data/camera/nameList
"
,
str
(
nameList
))
threading
.
Thread
(
target
=
publish
(
"
incoming/data/camera/nameList
"
,
nameList
)).
start
()
imageUrl
=
data
[
'
imageUrl
'
]
status
=
client
.
publish
(
"
incoming/data/camera/imageUrl
"
,
str
(
imageUrl
))
threading
.
Thread
(
target
=
publish
(
"
incoming/data/camera/imageUrl
"
,
imageUrl
)).
start
()
return
'
{
"
code
"
:200}
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment