Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import gradio as gr
import whisper
from datetime import datetime
last_model_name = "small"
model = whisper.load_model(last_model_name)
@msly
msly / _create_random.cpp
Last active June 20, 2016 03:27
生成类似java的随机数
// 0.8822016520425677
std::string _create_random()
{
static default_random_engine random;
uniform_real_distribution<double> dis(0.0, 1.0);
uniform_int_distribution<int> dis2(100000000, 999999999);
return fmt::format("{}{}", dis(random), dis2(random));
}
@msly
msly / 百度开灯问题.cpp
Last active June 20, 2016 03:27
百度开灯问题
// 百度开灯问题
void light() {
vector<bool> vec(100, true);
for (int i=1; i<101; ++i) {
for (int j=0; j<vec.size(); j=j+i+1) {
vec[j] = !vec[j];
}
}
@msly
msly / phash.cpp
Last active November 14, 2016 08:45
图片相似算法phash
string pHashValue(Mat &src) {
// gray
assert(src.channels() == 1);
string hash(64, '\0');
Mat img, dst;
resize(src, img, Size(32, 32));
img = Mat_<double>(img);