LapStore commited on
Commit
1918f2b
·
1 Parent(s): 67c10a3
Files changed (3) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +12 -9
  3. index.html +13 -0
__pycache__/app.cpython-311.pyc ADDED
Binary file (1.02 kB). View file
 
app.py CHANGED
@@ -1,13 +1,16 @@
1
- from fastapi import FastAPI ,Request
 
 
2
 
3
  app = FastAPI()
4
 
5
- @app.get("/")
6
- def greet_json():
7
- return {"Hello": "World!"}
 
8
 
9
- @app.post("/")
10
- def greet_json(request: Request):
11
- data = request.json() # Get the JSON body of the request
12
- name = data.get("name", "World") # Extract "name" from the request
13
- return {"Hello": name}
 
1
+ from fastapi import FastAPI ,Request ,Form
2
+ import numpy as np
3
+ from fastapi.responses import JSONResponse
4
 
5
  app = FastAPI()
6
 
7
+ # Root route
8
+ @app.get('/')
9
+ def hello_world():
10
+ return "Hello World taha"
11
 
12
+
13
+ @app.post('/predict')
14
+ def predict(name: str = Form(...),age: str = Form(...)): # Form(...) to accept input as web form ,may change when android /upload
15
+ # Return the submitted 'image' value as the prediction
16
+ return f"Your name is {name} \n age is {age}"
index.html ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <body bgcolor="#00cccc">
3
+ <center>
4
+ <br><br><br>
5
+ <form action="http://127.0.0.1:8000/predict" method="post">
6
+ <p><h3>Enter Image:</h3></p>
7
+ Name :<p><input type="text" name="name" /></p><br>
8
+ Age :<p><input type="text" name="age" /></p><br>
9
+ <p><input type="submit" value="submit" /></p>
10
+ </form>
11
+ </center>
12
+ </body>
13
+ </html>