jobian commited on
Commit
3a4c6fc
·
1 Parent(s): f6cfeb8

Added test routes

Browse files
Files changed (2) hide show
  1. app.py +10 -0
  2. test_huggingface.py +10 -0
app.py CHANGED
@@ -45,6 +45,16 @@ def docling_process_files(file_list: List[str]) -> str:
45
  return cleaned_text
46
 
47
 
 
 
 
 
 
 
 
 
 
 
48
  @app.post("/parse")
49
  async def parse_docling(file: UploadFile = File(...)):
50
  if not file:
 
45
  return cleaned_text
46
 
47
 
48
+ @app.get("/")
49
+ def root():
50
+ return JSONResponse(content={"message": "Root is working"})
51
+
52
+
53
+ @app.get("/health")
54
+ def health_check():
55
+ return JSONResponse(content={"status": "ok"})
56
+
57
+
58
  @app.post("/parse")
59
  async def parse_docling(file: UploadFile = File(...)):
60
  if not file:
test_huggingface.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ file_path = "C:/Users/Job Ian/Desktop/iSURE/rare-diseases/data/legislatures/AZ_h_1913_apr_special_p9.png"
4
+ url = "https://huggingface.co/spaces/jobian/smoldocling-api/parse"
5
+
6
+ with open(file_path, "rb") as f:
7
+ response = requests.post(url, files={"file": f})
8
+
9
+ print(response.status_code)
10
+ print(response.json())