Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from neural_searcher import NeuralSearcher
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
neural_searcher = NeuralSearcher(collection_name="odluke-demo")
|
| 7 |
+
|
| 8 |
+
@app.get("/")
|
| 9 |
+
async def root():
|
| 10 |
+
return {"message": "Hello World"}
|
| 11 |
+
|
| 12 |
+
@app.get("/api/search")
|
| 13 |
+
def search_startup(q: str):
|
| 14 |
+
return {"result": neural_searcher.search(text=q)}
|