katanaml / sparrow

Data processing with ML, LLM and Vision LLM
https://katanaml.io
GNU General Public License v3.0
3.73k stars 379 forks source link

Simple fix for the router `/inference` #67

Closed RockyNiu closed 3 months ago

RockyNiu commented 3 months ago

simple fix(router): Handle 403 errors for certain image URLs in /inference endpoint (for example, "https://www.rbac.org.br/wp-content/uploads/2018/10/21.png")

Test it by

curl -X 'POST' \
  'http://127.0.0.1:8000/api/v1/sparrow-ocr/inference' \
  -H 'accept: application/json' \
  -F 'image_url=https://www.rbac.org.br/wp-content/uploads/2018/10/21.png'

The response before the fix:

Internal Server Error

(internal error urllib.error.HTTPError: HTTP Error 403: Forbidden)

The response after the fix:

[["Table 01 - Examples of drugs with his appointment, the possible changes in aboratorytests and its mechanism. (Part 1)"],["Medicine"],["Indication"],["Laboratory"],["Changes"],["Mechanism of action"],["Paracetamol"],["Antipyretc"],["Alkaline phosphatase"],["Increase"],["High dosage associated with ???"],["Analgesic1"],["Bilirubin"],["Increase"],["Glucose"],["Dearease"],["Hepatic injurydue to high dosage"],["Chorine"],["Uric acid"],["Increase"],["Sodium"],["Increase"],["Deaease"],["Cacium"],["Bicarbonate"],["Dearease"],["Dearease"],["Chorine"],["Increase"],["Acetazolamide"],["Ooular hypotensive; Diuretic"],["Bilirubin"],["Increase"],["Uric acid"],["Increase"],["Glucose"],["Increase"],["Ammonia"],["Increase"],["Alkaline phosphatase"],["Sodium"],["Increase"],["Dearease"],["Bicarbonate"],["Dearease"],["Calcium"],["Dearease"],["Acydovir"],["Initial treatment and prophylactic"],["Urea"],["Increase"],["Leukopenia"],["treatment of mucosal and"],["Alkaline phosphatase"],["Bilirubin"],["Increase"],["Increase"],["cutaneous herpes infection"],["Creatinina"],["Increase"],["Reversible renal faiure"],["Amitriptyline"],["Antdepressant"],["Alkaline phosphatase"],["Increase"],["Ascorbic aoid"],["Food supplement"],["Bilirrubin"],["Increase"],["Urinaryglucose"],["False (+)"],["Reagent cupric sulfate"],["False ()"],["Glucose oxidase method"],["Badofen"],["Reaxing skeletal musole"],["Glucose"],["Increase"],["Ammonia"],["Increase"],["Bilirubin"],["Dearease"],["Cortcosteroids"],["Ant-inflammatorysteroid"],["Chorine"],["Increase"],["Salt-water Retention"],["Dexamethasone"],["Glucose"],["Increase"],["Gluconeogenesis"],["Hydrocortisone"],["Phosphor"],["Dearease"],["Glucose spending"],["Betamethasone"],["Potassium"],["Decrease"],["Methylprednisolone"],["Increase"],["Renal loss"],["Prednisone"],["Amyase"],["Increase"],["Salt-water Retenton"],["Prednisolone"],["Cholesterol"],["Increase"],["Protein"],["Increase"],["Thyroxine"],["Decrease"],["Buspirone"],["Anxolytc"],["AST"],["Increase"],["ALT"],["Increase"],["Calcitriol"],["Food supplement"],["Cholesterol"],["Increase"],["Magnesium"],["Increase"],["Urea"],["Increase"],["Captopril"],["Anthypertensive"],["Direct coombs"],["Increase"],["Cholesterol"],["False (+)"],["Dearease"],["Potassium"],["Urinaryacetone"],["Increase"],["Use of the reagent based on sodium nitoprusside"],["Urea"],["Increase"],["Hypoaldosteronism"],["Creatinine"],["Increase"],["Cephalexin"],["Antbiotc"],["Urinaryglucose"],["False (+)"],["Reagent cupric sulfate"],["Chlorpropamide oral"],["Antidiabetic"],["Direct coombs"],["Positive"],["Cholesterol"],["Dearease"],["Sodium"],["Dearease"],["Uncontrolled increase searetion ofADH5"],["Cimetidine"],["Antulceroso"],["AST"],["Increase"],["ALT"],["Increase"],["Cydosporine"],["Immunosuppressant"],["Potassium"],["Increase"],["Decreased excretion"],["Diazepam"],["Anxolytc"],["Urinaryglucose"],["False (-)"],["Method of glucose oxidase"],["Diltiaz em"],["Antanginal"],["Bilirubin"],["Increase"],["Uric acid"],["Increase"],["Leads to the appearance of fhe drop"]]
abaranovskis-redsamurai commented 3 months ago

Thanks a lot!