Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,22 @@
|
|
| 1 |
import os
|
| 2 |
import psutil
|
|
|
|
| 3 |
#
|
| 4 |
import cpuinfo
|
| 5 |
-
from fastapi import FastAPI
|
|
|
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def get_container_cpu_count():
|
| 10 |
try:
|
| 11 |
# default CPU count from Python
|
|
|
|
| 1 |
import os
|
| 2 |
import psutil
|
| 3 |
+
from functools import lru_cache
|
| 4 |
#
|
| 5 |
import cpuinfo
|
| 6 |
+
from fastapi import FastAPI, Request, Body
|
| 7 |
+
from coreference_resolution import CoreferenceResolver
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
|
| 11 |
+
@lru_cache(maxsize=1)
|
| 12 |
+
def get_resolver():
|
| 13 |
+
return CoreferenceResolver()
|
| 14 |
+
|
| 15 |
+
@app.post(path="/api/v1/fastcoref")
|
| 16 |
+
def get_coref_resolution(text:str = Body(...)):
|
| 17 |
+
#result = resolver.resolve_with_confidence(text)
|
| 18 |
+
return text
|
| 19 |
+
|
| 20 |
def get_container_cpu_count():
|
| 21 |
try:
|
| 22 |
# default CPU count from Python
|