Skip to content

Commit 97aacdc

Browse files
committed
Fixing for Swift 3.1 Ubuntu Release Compatibility.
Using response.chain will cause `SIL verification failed` in Swift 3.1.1 Ubuntu 16.04 when building as `swift build -c release`
1 parent 779b031 commit 97aacdc

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

PADockerfile_build

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM perfectlysoft/perfectassistant:3.1
2+
# Perfect-COpenSSL-Linux.git--5093232834563591861/PADockerfile
3+
RUN apt-get -y update && apt-get install -y libssl-dev
4+
5+
# Perfect-LinuxBridge.git-1581036685432548022/PADockerfile
6+
RUN apt-get -y update && apt-get install -y uuid-dev
7+
8+
# Perfect-TensorFlow.git--7585565079711099406/PADockerfile
9+
RUN wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.2.0.tar.gz -O /tmp/tflib.tgz && tar xvf /tmp/tflib.tgz -C /usr/local ./lib/libtensorflow.so && rm /tmp/tflib.tgz
10+
RUN rm -rf /var/lib/apt/lists/*

Sources/main.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,36 +88,36 @@ func handler(data: [String:Any]) throws -> RequestHandler {
8888
let scanner = inceptionModel
8989
else {
9090
response.setHeader(.contentType, value: "text/json")
91-
.appendBody(string: "{\"value\": \"Invalid Input\"}")
92-
.completed()
91+
response.appendBody(string: "{\"value\": \"Invalid Input\"}")
92+
response.completed()
9393
return
9494
}//end
9595
let jpeg = Data.From(b64)
9696
guard let data = Data(base64Encoded: jpeg) else {
9797
response.setHeader(.contentType, value: "text/json")
98-
.appendBody(string: "{\"value\": \"Input is not a valid jpeg\"}")
99-
.completed()
98+
response.appendBody(string: "{\"value\": \"Input is not a valid jpeg\"}")
99+
response.completed()
100100
return
101101
}//end guard
102102

103103
do {
104104
let result = try scanner.match(image: data)
105105
guard result.0 > -1 && result.0 < tags.count else {
106106
response.setHeader(.contentType, value: "text/json")
107-
.appendBody(string: "{\"value\": \"what is this???\"}")
108-
.completed()
107+
response.appendBody(string: "{\"value\": \"what is this???\"}")
108+
response.completed()
109109
return
110110
}//end
111111
let tag = tags[result.0]
112112
let p = result.1
113113
response.setHeader(.contentType, value: "text/json")
114-
.appendBody(string: "{\"value\": \"Is it a \(tag)? (Possibility: \(p)%)\"}")
115-
.completed()
114+
response.appendBody(string: "{\"value\": \"Is it a \(tag)? (Possibility: \(p)%)\"}")
115+
response.completed()
116116
print(tag, p)
117117
}catch {
118118
response.setHeader(.contentType, value: "text/json")
119-
.appendBody(string: "{\"value\": \"\(error)\"}")
120-
.completed()
119+
response.appendBody(string: "{\"value\": \"\(error)\"}")
120+
response.completed()
121121
print("\(error)")
122122
}
123123
}

0 commit comments

Comments
 (0)