TymaaHammouda commited on
Commit
beec65b
·
1 Parent(s): c159de8

Import and use SinaTools

Browse files
Files changed (2) hide show
  1. app.py +18 -1
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,7 +1,24 @@
1
  from fastapi import FastAPI
 
 
 
2
 
3
  app = FastAPI()
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  @app.get("/predict")
6
  def greet_json():
7
- return {"Hello": "World!"}
 
 
1
  from fastapi import FastAPI
2
+ from sinatools.DataDownload.downloader import download_folder_from_hf
3
+ from sinatools.wsd.disambiguator import disambiguate
4
+ import os
5
 
6
  app = FastAPI()
7
 
8
+ SINATOOLS_DIR = os.path.expanduser("~/.sinatools")
9
+ os.makedirs(SINATOOLS_DIR, exist_ok=True)
10
+
11
+ # Destination path
12
+ dest_path = os.path.join(SINATOOLS_DIR)
13
+
14
+ # Download explicitly to the expected path
15
+ download_folder_from_hf("SinaLab/ArabGlossBERT", "bert-base-arabertv02_22_May_2021_00h_allglosses_unused01")
16
+ download_folder_from_hf("SinaLab/ArabGlossBERT", "bert-base-arabertv02")
17
+
18
+ # download_file(url='https://sina.birzeit.edu/four_grams.pickle', dest_path=dest_path)
19
+
20
+
21
  @app.get("/predict")
22
  def greet_json():
23
+ salma_output = disambiguate('تمشيت بين الجداول والأنهار')
24
+ return {"output": salma_output}
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  fastapi
2
- uvicorn[standard]
 
 
1
  fastapi
2
+ uvicorn[standard]
3
+ SinaTools