Skip to content

Instantly share code, notes, and snippets.

View titipata's full-sized avatar
:octocat:

Titipat Achakulvisut titipata

:octocat:
View GitHub Profile
@titipata
titipata / app.py
Created July 10, 2024 04:46
Thonburian Whisper demo with Gradio > 4.0.0
import torch
import gradio as gr
import pytube as pt
from transformers import pipeline
from huggingface_hub import model_info
MODEL_NAME = "biodatlab/whisper-th-medium-combined" # this always needs to stay in line 8 :D sorry for the hackiness
lang = "th"
device = 0 if torch.cuda.is_available() else "cpu"
Theme1 Topic1 SubTopic1 n_submission
Theme A: Development A.01. Neurogenesis and Gliogenesis A.01.a. Nervous system patterning and developmental cell death 13
Theme A: Development A.01. Neurogenesis and Gliogenesis A.01.b. Proliferation: Self-renewal and cell cycle 10
Theme A: Development A.01. Neurogenesis and Gliogenesis A.01.c. Proliferation: Molecular mechanisms 10
Theme A: Development A.01. Neurogenesis and Gliogenesis A.01.d. Cell lineage 17
Theme A: Development A.01. Neurogenesis and Gliogenesis A.01.e. Mechanisms of cell fate 31
Theme A: Development A.01. Neurogenesis and Gliogenesis A.01.f. Cell migration 18
Theme A: Development A.01. Neurogenesis and Gliogenesis A.01.g. Neuronal differentiation 31
Theme A: Development A.01. Neurogenesis and Gliogenesis A.01.h. Glial differentiation and interaction with neurons 21
Theme A: Development A.02. Postnatal Neurogenesis A.02 b. Postnatal neurogenesis: Molecular mechanisms 23
[{'description': 'บริษัทไปรษณีย์ไทย',
'vertices': [(528, 202), (741, 202), (741, 222), (528, 222)]},
{'description': 'จํากัด',
'vertices': [(754, 204), (809, 204), (809, 222), (754, 222)]},
{'description': 'พุทธมณฑล',
'vertices': [(562, 240), (686, 237), (686, 254), (562, 257)]},
{'description': '73170',
'vertices': [(707, 234), (777, 232), (777, 253), (707, 255)]},
{'description': 'สาขาที่',
'vertices': [(494, 261), (578, 261), (578, 291), (494, 291)]},
person_id person_id_to_meet
4 9;27;131;202;284;332;383;442;456;487
5 24;99;129;155;268;278;319;505;516;554
7 49;198;226;272;288;341;588;593;595;614
9 4;27;98;177;233;268;309;487;520;551
10 137;143;176;212;460;472;515;598;606;618
12 121;151;156;312;315;316;362;511;543;554
15 97;98;217;225;231;288;438;477;520;542
17 49;105;337;340;375;412;525;548;579;586
18 23;112;314;526;572;578;596;611;625;626
import os
import json
import torch
import deepcut
import numpy as np

# load model and corpus
device = torch.device("cpu")
with open('./thai-song-model.pt', 'rb') as f:
# -*- coding: utf-8 -*-
"""
A backend service for Penn event calendar
Run the app:
$ python api.py
This will serve on localhost:5000.
"""
import os

Thai songs similarity (experiment)

Create affinity matrix from Thai songs' spectogram

import os
import cv2
from skimage.measure import compare_ssim

dir_name = '/path/to/thaisongs/'
@titipata
titipata / convert_spectogram.md
Last active May 4, 2018 09:02
Convert MP4 to Spectogram

Convert files in MP4 folder to FLAC

Scipt to convert

import os
from glob import glob
import subprocess

MP4_PATH = '~/Desktop/notebooks/mp4/*.m4a' # path to all mp4 files

Pretrain bin to txt

Function to turn word vector from http://bio.nlplab.org/#word-vectors into text file format so that easily read.

def w2v_binary_to_text(file_path):
    """
    Function to transform binary file of word vector file
    to text file format
    Ref: http://bio.nlplab.org/#word-vectors

Script for scraping train arrival time

Get list of date from today until 250 days before.

import requests
import time
import datetime

numdays = 250