Rohithm16 commited on
Commit
f4f72e0
·
verified ·
1 Parent(s): 0760700

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from pydantic import BaseModel
3
+
4
+ app = FastAPI()
5
+
6
+ class Ping(BaseModel):
7
+ message: str
8
+
9
+ @app.get("/")
10
+ def root():
11
+ return {"status": "space is alive 🚀"}
12
+
13
+ @app.post("/echo")
14
+ def echo(data: Ping):
15
+ return {
16
+ "you_sent": data.message,
17
+ "working": True
18
+ }