Spaces:
Sleeping
Sleeping
Update app/main.py
Browse files- app/main.py +3 -10
app/main.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
from fastapi import FastAPI
|
|
|
2 |
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,17 +14,9 @@ model_tag = "facebook/opt-125m"
|
|
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 |
-
|
25 |
-
return response
|
26 |
-
|
27 |
|
28 |
@app.post("/language-detection")
|
29 |
def language_detection(text):
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
from fastapi.responses import RedirectResponse
|
3 |
from pydantic import BaseModel
|
4 |
from model.model import LLM
|
5 |
import torch
|
6 |
|
7 |
+
app = FastAPI()
|
8 |
|
9 |
class InputText(BaseModel):
|
10 |
text: str
|
|
|
14 |
model = LLM(model_name = model_tag,
|
15 |
device = "cuda" if torch.cuda.is_available() else "cpu")
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
@app.get("/")
|
18 |
async def docs_redirect():
|
19 |
+
return RedirectResponse(url='/docs')
|
|
|
|
|
20 |
|
21 |
@app.post("/language-detection")
|
22 |
def language_detection(text):
|