-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6e86e3
commit ac33d14
Showing
6 changed files
with
155 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
FROM ubuntu:20.04 | ||
RUN mkdir /work | ||
COPY ../eval /work | ||
WORKDIR /work | ||
COPY ./ /work | ||
RUN mkdir -p /work/results | ||
WORKDIR /work/eval | ||
RUN apt-get update && apt-get install -y python3 python3-pip python3-dev gcc g++ libffi-dev libssl-dev | ||
RUN pip install cython | ||
RUN pip install cryptography | ||
RUN pip install -r requirements.txt | ||
RUN pip install gunicorn | ||
RUN pip install -r /work/deploy/requirements.txt | ||
|
||
ENTRYPOINT ["gunicorn", "--workers=4", "--bind=0.0.0.0:5000", "deploy:app"] | ||
EXPOSE 5000 | ||
|
||
ENTRYPOINT ["gunicorn", "--workers=4", "--log-level", "debug", "--bind=0.0.0.0:5000", "deploy:app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
cur_makefile_path := $(dir $(mkfile_path)) | ||
build: | ||
docker build $(cur_makefile_path)\.. -f $(cur_makefile_path)\Dockerfile -t multi-benchmark --progress=plain | ||
|
||
run: | ||
docker run --name multi-benchmark_test -p 5000:5000 -v $(cur_makefile_path)/../data:/work/data -d multi-benchmark |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Fetch File Example</title> | ||
</head> | ||
<body> | ||
<h1>Upload and Send File Example</h1> | ||
|
||
<input type="file" id="fileInput"> | ||
<button id="sendButton">Send File</button> | ||
|
||
<script> | ||
document.getElementById('sendButton').addEventListener('click', function() { | ||
const fileInput = document.getElementById('fileInput'); | ||
const file = fileInput.files[0]; | ||
|
||
if (file) { | ||
const reader = new FileReader(); | ||
|
||
reader.onload = function(event) { | ||
const fileContent = event.target.result; | ||
const jsonData = { fileContent: fileContent }; | ||
|
||
fetch('http://127.0.0.1:5000/generate', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
// 如果有需要,可以根据后端要求设置其他headers | ||
}, | ||
body: JSON.stringify({ | ||
"prediction_json": jsonData | ||
}) | ||
}) | ||
.then(response => { | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
return response.blob(); | ||
}) | ||
.then(blob => { | ||
const url = window.URL.createObjectURL(blob); | ||
const a = document.createElement('a'); | ||
a.href = url; | ||
a.download = 'result.zip'; // 下载文件的名称 | ||
document.body.appendChild(a); | ||
a.click(); | ||
window.URL.revokeObjectURL(url); | ||
}) | ||
.catch(error => { | ||
console.error('There has been a problem with your fetch operation:', error); | ||
}); | ||
}; | ||
|
||
reader.readAsText(file); | ||
} else { | ||
console.log('Please select a file to upload.'); | ||
} | ||
}); | ||
|
||
|
||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters