This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import requests | |
# Set up Datasaur API | |
API_URL = "https://deployment.datasaur.ai/api/deployment/8/1937/chat/completions" | |
headers = { | |
'Authorization': 'Bearer <api-key>', | |
'Content-Type': 'application/json' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import os | |
import sys | |
import re | |
from pathlib import Path | |
from urllib.parse import urlparse, parse_qs | |
import aiohttp | |
import aiofiles | |
from typing import Any, Sequence | |
import logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import json | |
import logging | |
from typing import Any, Dict, Optional | |
import modal | |
from fastapi import FastAPI, Request | |
from fastapi.responses import JSONResponse, StreamingResponse, Response | |
from pydantic import BaseModel | |
# Modal app configuration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
proxy_pass http://0.0.0.0:8501/; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
training_points = [0, 10, 25, 50, 100, 250, 500] | |
bert_acc = [0.5310526315789473, 0.5727631578947369, 0.6130263157894736, 0.8502631578947368, 0.8619736842105263, 0.8727631578947368, 0.8660526315789474] | |
roberta_acc = [0.49236842105263157, 0.6001315789473685, 0.7292105263157894, 0.7705263157894737, 0.8469736842105263, 0.8442105263157895, 0.8730263157894737] | |
plt.plot(training_points, bert_acc, label="bert-base-uncased") | |
plt.plot(training_points, roberta_acc, label="roberta-base") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flask==1.0.2 | |
opencv-python==4.0.1.23 | |
opencv-python-headless==4.5.1.48 | |
pyyaml==5.3.1 | |
shapely==1.7.0 | |
pandas==0.24.2 | |
requests==2.23.0 | |
albumentations==0.4.5 | |
glog==0.3.1 | |
gunicorn==20.0.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
save_keeping_v2 = { | |
"1_000": None, | |
"1_001": { | |
"jenis_dokumen": { | |
"text": "INVOICE", | |
}, | |
"nomor_dokumen": { | |
"text": "cloudmob015", | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gunicorn -w 5 -b 127.0.0.1:8811 api:app -t 120 --reload --max-requests 100 --access-logfile log.txt --access-logformat '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %({X-REMOTE-ADDR}i)s %({X-REAL-IP}i)s' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/www/html; | |
server_name _; | |
index index.html index.htm index.nginx-debian.html; | |
location / { | |
proxy_read_timeout 600s; | |
proxy_connect_timeout 600s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
# Saving the objects: | |
with open('test1.pkl', 'wb') as f: # Python 3: open(..., 'wb') | |
pickle.dump([table_bbox, row_bbox, column_bbox], f) | |
# Getting back the objects: | |
with open('test1.pkl', 'rb') as f: # Python 3: open(..., 'rb') |
NewerOlder