iaroy commited on
Commit
b917742
·
1 Parent(s): bee4639

Create simplified FastAPI app following modern practices

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import uvicorn
3
+
4
+ # Create a FastAPI app for Hugging Face Spaces
5
+ app = FastAPI(title="Collinear API")
6
+
7
+ @app.get("/")
8
+ async def root():
9
+ return {"message": "Welcome to Collinear API"}
10
+
11
+ @app.get("/health")
12
+ async def health():
13
+ return {"status": "healthy"}
14
+
15
+ # Add more API endpoints here as needed
16
+ @app.get("/api/datasets")
17
+ async def list_datasets():
18
+ return {
19
+ "datasets": [
20
+ {"id": "1", "name": "Sample Dataset 1", "description": "Example dataset for demonstration"},
21
+ {"id": "2", "name": "Sample Dataset 2", "description": "Another example dataset"}
22
+ ]
23
+ }
24
+
25
+ if __name__ == "__main__":
26
+ # This is used when running locally
27
+ uvicorn.run("app:app", host="0.0.0.0", port=7860, reload=True)