finished demo. ready for deployment
This commit is contained in:
parent
e7b4eaac0b
commit
18b0dd0e47
15
app.js
15
app.js
@ -31,6 +31,21 @@ app.get('/script.js', (req, res) => {
|
||||
|
||||
});
|
||||
|
||||
app.get('/YOUR_IMAGE.jpg', (req, res) => {
|
||||
const imagePath = __dirname + '/static/YOUR_IMAGE.jpg';
|
||||
const imageStats = fs.statSync(imagePath);
|
||||
const fileSize = imageStats.size;
|
||||
const imageType = 'image/jpeg';
|
||||
|
||||
// Set the 'Content-Type' header with the correct MIME type
|
||||
res.setHeader('Content-Type', imageType);
|
||||
// Set the 'Content-Length' header with the file size
|
||||
res.setHeader('Content-Length', fileSize);
|
||||
// Pipe the image file to the response
|
||||
const imageStream = fs.createReadStream(imagePath);
|
||||
imageStream.pipe(res);
|
||||
});
|
||||
|
||||
app.post('/completions', async (req, res) => {
|
||||
try {
|
||||
const query = req.body.query;
|
||||
|
BIN
static/YOUR_IMAGE.jpg
Normal file
BIN
static/YOUR_IMAGE.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 179 KiB |
@ -6,14 +6,17 @@
|
||||
<title>Upload Image</title>
|
||||
</head>
|
||||
<body>
|
||||
<input type="file" id="imageInput" accept="image/*" required=""> <button onclick="uploadImage()" id="upload-image-btn">Upload Image</button>
|
||||
<input type="file" id="imageInput" accept="image/*" required=""> <button onclick="uploadImage()" id="upload-image-btn">Submit Image</button>
|
||||
<br><br>
|
||||
<a href="/YOUR_IMAGE.jpg" download="YOUR_IMAGE.jpg" class="download-button">
|
||||
Download Sample
|
||||
</a>
|
||||
<div id="editable-classes"></div>
|
||||
<button id="add-class-btn">Add Class</button>
|
||||
<button id="add-class-btn">Add Ingredient</button>
|
||||
<div id="suggested-classes"></div>
|
||||
<br>
|
||||
|
||||
<button onclick="generateIngredients()">Generate Ingredients</button>
|
||||
<button onclick="generateIngredients()">Generate Recipes</button>
|
||||
<script src="/script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user