Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
arun477 committed Sep 17, 2023
1 parent c772c06 commit 310a233
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pathlib import Path
import datetime
import numpy as np
from pydantic import BaseModel

app = FastAPI()

Expand Down Expand Up @@ -44,3 +45,14 @@ async def predict(image: UploadFile):
prediction = []
return {"prediction": prediction}

class Item(BaseModel):
name: str

@app.post("/home")
async def home(item: Item):
return {
'prediction': [{
'name': item['name']
}]
}

8 changes: 6 additions & 2 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,13 @@ <h3 style="text-align:center;">Draw and Predict Handwritten Digits</h3>
var imageData = canvas.toDataURL("image/png");
var formData = new FormData();
formData.append("image", dataURLtoBlob(imageData), "image.png");
fetch('/predict', {
// fetch('/predict', {
fetch('/home', {
method: 'POST',
body: formData,
// body: formData,
body: {
'name': 'arun'
},
})
.then(response => response.json())
.then(data => {
Expand Down

0 comments on commit 310a233

Please sign in to comment.