File size: 811 Bytes
56903cc
beec65b
 
 
56903cc
 
 
beec65b
 
 
 
 
 
 
 
 
 
 
 
 
c159de8
56903cc
beec65b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from fastapi import FastAPI
from sinatools.DataDownload.downloader import download_folder_from_hf
from sinatools.wsd.disambiguator import disambiguate
import os

app = FastAPI()

SINATOOLS_DIR = os.path.expanduser("~/.sinatools")
os.makedirs(SINATOOLS_DIR, exist_ok=True)

# Destination path
dest_path = os.path.join(SINATOOLS_DIR)

# Download explicitly to the expected path
download_folder_from_hf("SinaLab/ArabGlossBERT", "bert-base-arabertv02_22_May_2021_00h_allglosses_unused01")
download_folder_from_hf("SinaLab/ArabGlossBERT", "bert-base-arabertv02")   

# download_file(url='https://sina.birzeit.edu/four_grams.pickle', dest_path=dest_path)


@app.get("/predict")
def greet_json():
    salma_output = disambiguate('تمشيت بين الجداول والأنهار')
    return {"output": salma_output}