Spaces:
Sleeping
Sleeping
Update app/main.py
Browse files- app/main.py +9 -1
app/main.py
CHANGED
|
@@ -3,7 +3,7 @@ from pydantic import BaseModel
|
|
| 3 |
from model.model import LLM
|
| 4 |
import torch
|
| 5 |
|
| 6 |
-
app = FastAPI()
|
| 7 |
|
| 8 |
class InputText(BaseModel):
|
| 9 |
text: str
|
|
@@ -13,9 +13,17 @@ model_tag = "facebook/opt-125m"
|
|
| 13 |
model = LLM(model_name = model_tag,
|
| 14 |
device = "cuda" if torch.cuda.is_available() else "cpu")
|
| 15 |
|
|
|
|
| 16 |
@app.get("/")
|
| 17 |
async def root():
|
| 18 |
return {"message": "Technical challenge OK"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
@app.post("/language-detection")
|
| 21 |
def language_detection(text):
|
|
|
|
| 3 |
from model.model import LLM
|
| 4 |
import torch
|
| 5 |
|
| 6 |
+
app = FastAPI(docs_url="/swagger-ui.html")
|
| 7 |
|
| 8 |
class InputText(BaseModel):
|
| 9 |
text: str
|
|
|
|
| 13 |
model = LLM(model_name = model_tag,
|
| 14 |
device = "cuda" if torch.cuda.is_available() else "cpu")
|
| 15 |
|
| 16 |
+
"""
|
| 17 |
@app.get("/")
|
| 18 |
async def root():
|
| 19 |
return {"message": "Technical challenge OK"}
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
@app.get("/")
|
| 23 |
+
async def docs_redirect():
|
| 24 |
+
response = RedirectResponse(url='/swagger-ui.html')
|
| 25 |
+
return response
|
| 26 |
+
|
| 27 |
|
| 28 |
@app.post("/language-detection")
|
| 29 |
def language_detection(text):
|