Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
|
@@ -53,6 +53,12 @@ async def image_to_image(model_name: str = Form(...), file: UploadFile = File(..
|
|
| 53 |
results = model.image_to_image(image, top_k)
|
| 54 |
return results
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
@app.get("/health")
|
| 57 |
def health_check():
|
| 58 |
return {"status": "healthy"}
|
|
|
|
| 53 |
results = model.image_to_image(image, top_k)
|
| 54 |
return results
|
| 55 |
|
| 56 |
+
@app.post("/search/text2text")
|
| 57 |
+
async def text_to_text(model_name: str = Form(...), query: str = Form(...), top_k: int = Form(5)):
|
| 58 |
+
model = get_model(model_name)
|
| 59 |
+
results = model.text_to_text(query, top_k)
|
| 60 |
+
return results
|
| 61 |
+
|
| 62 |
@app.get("/health")
|
| 63 |
def health_check():
|
| 64 |
return {"status": "healthy"}
|