id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
1,012 | import os
from typing import Dict, List
import csv
The provided code snippet includes necessary dependencies for implementing the `get_default_result_dict` function. Write a Python function `def get_default_result_dict(dir: str, data_name: str, index_name: str, fea_name: str) -> Dict` to solve the following problem:
G... | Get the default result dict based on the experimental factors. Args: dir (str): the path of one single extracted feature directory. data_name (str): the name of the dataset. index_name (str): the name of query process. fea_name (str): the name of the features to be loaded. Returns: result_dict (Dict): a default configu... |
1,013 | import os
from typing import Dict, List
import csv
The provided code snippet includes necessary dependencies for implementing the `save_to_csv` function. Write a Python function `def save_to_csv(results: List[Dict], csv_path: str) -> None` to solve the following problem:
Save the search results in a csv format file. A... | Save the search results in a csv format file. Args: results (List): a list of retrieval results. csv_path (str): the path for saving the csv file. |
1,014 | import os
from typing import Dict, List
import csv
The provided code snippet includes necessary dependencies for implementing the `filter_by_keywords` function. Write a Python function `def filter_by_keywords(results: List[Dict], keywords: Dict) -> List[Dict]` to solve the following problem:
Filter the search results ... | Filter the search results according to the given keywords Args: results (List): a list of retrieval results. keywords (Dict): a dict containing keywords to be selected. Returns: |
1,015 | from yacs.config import CfgNode
from copy import deepcopy
def _convert_dict_to_cfg(d: dict) -> CfgNode:
ret = CfgNode()
for key in d:
if isinstance(d[key], dict):
ret[key] = _convert_dict_to_cfg(d[key])
else:
ret[key] = d[key]
return ret | null |
1,016 | from yacs.config import CfgNode
from .registry import EVALUATORS
from ..utils import get_config_from_registry
def get_evaluator_cfg() -> CfgNode:
cfg = get_config_from_registry(EVALUATORS)
cfg["name"] = "unknown"
return cfg
def get_evaluate_cfg() -> CfgNode:
cfg = CfgNode()
cfg["evaluator"] = get_e... | null |
1,017 | from yacs.config import CfgNode
from .registry import EVALUATORS
from .evaluator import EvaluatorBase
from .helper import EvaluateHelper
from ..utils import simple_build
def build_evaluator(cfg: CfgNode) -> EvaluatorBase:
"""
Instantiate a evaluator class.
Args:
cfg (CfgNode): the configuration tree... | Instantiate a evaluate helper class. Args: cfg (CfgNode): the configuration tree. Returns: helper (EvaluateHelper): a evaluate helper class. |
1,018 | from yacs.config import CfgNode
from .registry import ENHANCERS, METRICS, DIMPROCESSORS, RERANKERS
from ..utils import get_config_from_registry
def get_enhancer_cfg() -> CfgNode:
cfg = get_config_from_registry(ENHANCERS)
cfg["name"] = "unknown"
return cfg
def get_metric_cfg() -> CfgNode:
cfg = get_confi... | null |
1,019 | from yacs.config import CfgNode
from .registry import ENHANCERS, METRICS, DIMPROCESSORS, RERANKERS
from .feature_enhancer import EnhanceBase
from .helper import IndexHelper
from .metric import MetricBase
from .dim_processor import DimProcessorBase
from .re_ranker import ReRankerBase
from ..utils import simple_build
fro... | Instantiate a index helper class. Args: cfg (CfgNode): the configuration tree. Returns: helper (IndexHelper): an instance of index helper class. |
1,020 | from yacs.config import CfgNode
from .registry import EXTRACTORS, SPLITTERS, AGGREGATORS
from ..utils import get_config_from_registry
def get_aggregators_cfg() -> CfgNode:
def get_splitter_cfg() -> CfgNode:
def get_extractor_cfg() -> CfgNode:
def get_extract_cfg() -> CfgNode:
cfg = CfgNode()
cfg["assemble"] = ... | null |
1,021 | from yacs.config import CfgNode
from .registry import AGGREGATORS, SPLITTERS, EXTRACTORS
from .extractor import ExtractorBase
from .splitter import SplitterBase
from .aggregator import AggregatorBase
from .helper import ExtractHelper
from ..utils import simple_build
import torch.nn as nn
from typing import List
def bui... | Instantiate a extract helper class. Args: model (nn.Module): the model for extracting features. cfg (CfgNode): the configuration tree. Returns: helper (ExtractHelper): an instance of extract helper class. |
1,022 | import os
from shutil import copyfile
The provided code snippet includes necessary dependencies for implementing the `split_dataset` function. Write a Python function `def split_dataset(dataset_path: str, split_file: str) -> None` to solve the following problem:
Split the dataset according to the given splitting rules... | Split the dataset according to the given splitting rules. Args: dataset_path (str): the path of the dataset. split_file (str): the path of the file containing the splitting rules. |
1,023 | import pickle
import os
def make_ds_for_general(dataset_path: str, save_path: str) -> None:
"""
Generate data json file for dataset collecting images with the same label one directory. e.g. CUB-200-2011.
Args:
dataset_path (str): the path of the dataset.
save_ds_path (str): the path for savi... | Generate data json file for dataset. Args: dataset_path (str): the path of the dataset. save_ds_path (str): the path for saving the data json files. type (str): the structure type of the dataset. gt_path (str, optional): the path of the ground truth, necessary for Oxford. |
1,024 | from yacs.config import CfgNode
from ..datasets import get_datasets_cfg
from ..models import get_model_cfg
from ..extract import get_extract_cfg
from ..index import get_index_cfg
from ..evaluate import get_evaluate_cfg
The provided code snippet includes necessary dependencies for implementing the `get_defaults_cfg` fu... | Construct the default configuration tree. Returns: cfg (CfgNode): the default configuration tree. |
1,025 | from yacs.config import CfgNode
from ..datasets import get_datasets_cfg
from ..models import get_model_cfg
from ..extract import get_extract_cfg
from ..index import get_index_cfg
from ..evaluate import get_evaluate_cfg
The provided code snippet includes necessary dependencies for implementing the `setup_cfg` function.... | Load a yaml config file and merge it this CfgNode. Args: cfg (CfgNode): the configuration tree with default structure. cfg_file (str): the path for yaml config file which is matched with the CfgNode. cfg_opts (list, optional): config (keys, values) in a list (e.g., from command line) into this CfgNode. Returns: cfg (Cf... |
1,026 | from yacs.config import CfgNode
from .registry import COLLATEFNS, FOLDERS, TRANSFORMERS
from ..utils import get_config_from_registry
def get_collate_cfg() -> CfgNode:
cfg = get_config_from_registry(COLLATEFNS)
cfg["name"] = "unknown"
return cfg
def get_folder_cfg() -> CfgNode:
cfg = get_config_from_regi... | null |
1,027 | from yacs.config import CfgNode
from .registry import COLLATEFNS, FOLDERS, TRANSFORMERS
from .collate_fn import CollateFnBase
from .folder import FolderBase
from .transformer import TransformerBase
from ..utils import simple_build
from torch.utils.data import DataLoader
from torchvision.transforms import Compose
def bu... | Instantiate a folder class with the given configuration tree. Args: data_json_path (str): the path of the data json file. cfg (CfgNode): the configuration tree. Returns: folder (FolderBase): a folder class. |
1,028 | from yacs.config import CfgNode
from .registry import COLLATEFNS, FOLDERS, TRANSFORMERS
from .collate_fn import CollateFnBase
from .folder import FolderBase
from .transformer import TransformerBase
from ..utils import simple_build
from torch.utils.data import DataLoader
from torchvision.transforms import Compose
def bu... | Instantiate a data loader class with the given configuration tree. Args: folder (FolderBase): the folder function. cfg (CfgNode): the configuration tree. Returns: data_loader (DataLoader): a data loader class. |
1,029 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
The provided code snippet includes necessary dependencies for implementing the `conv3x3` function. Write a Python function `def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1)` to solve the foll... | 3x3 convolution with padding |
1,030 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
The provided code snippet includes necessary dependencies for implementing the `conv1x1` function. Write a Python function `def conv1x1(in_planes, out_planes, stride=1)` to solve the following problem:
1x1 con... | 1x1 convolution |
1,031 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class BasicBlock(nn.Module):
expansion = 1
__constants__ = ['downsample']
def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1,
base_width=64, dilation=1, norm_l... | r"""ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,032 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class BasicBlock(nn.Module):
expansion = 1
__constants__ = ['downsample']
def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1,
base_width=64, dilation=1, norm_l... | r"""ResNet-34 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,033 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class Bottleneck(nn.Module):
expansion = 4
__constants__ = ['downsample']
def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1,
base_width=64, dilation=1, norm_l... | r"""ResNet-50 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,034 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class Bottleneck(nn.Module):
expansion = 4
__constants__ = ['downsample']
def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1,
base_width=64, dilation=1, norm_l... | r"""ResNet-101 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,035 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class Bottleneck(nn.Module):
expansion = 4
__constants__ = ['downsample']
def __init__(self, inplanes, planes, stride=1, downsample=None, groups=1,
base_width=64, dilation=1, norm_l... | r"""ResNet-152 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,036 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=True):
super(VGG, self).__init__()
self.features = features
self.avgpool = nn.AdaptiveAvgPool2d((7, ... | r"""VGG 11-layer model (configuration "A") from `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,037 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=True):
super(VGG, self).__init__()
self.features = features
self.avgpool = nn.AdaptiveAvgPool2d((7, ... | r"""VGG 11-layer model (configuration "A") with batch normalization `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to... |
1,038 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=True):
super(VGG, self).__init__()
self.features = features
self.avgpool = nn.AdaptiveAvgPool2d((7, ... | r"""VGG 13-layer model (configuration "B") `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,039 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=True):
super(VGG, self).__init__()
self.features = features
self.avgpool = nn.AdaptiveAvgPool2d((7, ... | r"""VGG 13-layer model (configuration "B") with batch normalization `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to... |
1,040 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=True):
super(VGG, self).__init__()
self.features = features
self.avgpool = nn.AdaptiveAvgPool2d((7, ... | r"""VGG 16-layer model (configuration "D") `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,041 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=True):
super(VGG, self).__init__()
self.features = features
self.avgpool = nn.AdaptiveAvgPool2d((7, ... | r"""VGG 16-layer model (configuration "D") with batch normalization `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to... |
1,042 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=True):
super(VGG, self).__init__()
self.features = features
self.avgpool = nn.AdaptiveAvgPool2d((7, ... | r"""VGG 19-layer model (configuration "E") `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr |
1,043 | import torch
import torch.nn as nn
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
class VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=True):
super(VGG, self).__init__()
self.features = features
self.avgpool = nn.AdaptiveAvgPool2d((7, ... | r"""VGG 19-layer model (configuration 'E') with batch normalization `"Very Deep Convolutional Networks For Large-Scale Image Recognition" <https://arxiv.org/pdf/1409.1556.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to... |
1,044 | import torch
import torch.nn as nn
from torch.nn import init
from torchvision import models
from torch.autograd import Variable
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
def weights_init_kaiming(m):
classname = m.__class__.__name__
# print(classname)
if classname.find('Conv... | null |
1,045 | import torch
import torch.nn as nn
from torch.nn import init
from torchvision import models
from torch.autograd import Variable
from ..backbone_base import BackboneBase
from ...registry import BACKBONES
def weights_init_classifier(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
... | null |
1,046 | from yacs.config import CfgNode
from .backbone.backbone_base import BACKBONES
def get_model_cfg() -> CfgNode:
cfg = CfgNode()
for name in BACKBONES:
cfg[name] = CfgNode()
cfg[name]["load_checkpoint"] = ""
cfg["name"] = "unknown"
return cfg | null |
1,047 | from yacs.config import CfgNode
import torch
import torch.nn as nn
from .registry import BACKBONES
from ..utils import load_state_dict
from torchvision.models.utils import load_state_dict_from_url
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://downlo... | Instantiate a backbone class. Args: cfg (CfgNode): the configuration tree. Returns: model (nn.Module): the model for extracting features. |
1,048 |
def _register_generic(module_dict, module_name, module):
assert module_name not in module_dict
module_dict[module_name] = module | null |
1,049 | import os
import torch.nn as nn
from torch.nn import Parameter
from torchvision.models.utils import load_state_dict_from_url
from typing import Dict
The provided code snippet includes necessary dependencies for implementing the `ensure_dir` function. Write a Python function `def ensure_dir(path: str) -> None` to solve... | Check if a directory exists, if not, create a new one. Args: path (str): the path of the directory. |
1,050 | import os
import torch.nn as nn
from torch.nn import Parameter
from torchvision.models.utils import load_state_dict_from_url
from typing import Dict
The provided code snippet includes necessary dependencies for implementing the `load_state_dict` function. Write a Python function `def load_state_dict(model: nn.Module, ... | Load parameters regardless the shape of parameters with the same name need to match, which is a slight modification to load_state_dict of pytorch. Args: model (nn.Module): the model for extracting features. state_dict (Dict): a dict of model parameters. |
1,051 | from yacs.config import CfgNode
from .module_base import ModuleBase
from .registry import Registry
class Registry(dict):
"""
A helper class to register class.
"""
def __init__(self, *args, **kwargs):
super(Registry, self).__init__(*args, **kwargs)
def register(self, module):
_regis... | Collect all hyper-parameters from modules in registry. Args: registry (Registry): module registry. Returns: cfg (CfgNode): configurations for this registry. |
1,052 | from yacs.config import CfgNode
from .module_base import ModuleBase
from .registry import Registry
class Registry(dict):
"""
A helper class to register class.
"""
def __init__(self, *args, **kwargs):
super(Registry, self).__init__(*args, **kwargs)
def register(self, module):
_regis... | Simply build a module according to name and hyper-parameters. Args: name (str): name for instance to be built. cfg (CfgNode): configurations for this sub-module. registry (Registry): registry for this sub-module. **kwargs: keyword arguments. Returns: module: a initialized instance |
1,053 | import argparse
import os
import torch
from pyretri.config import get_defaults_cfg, setup_cfg
from pyretri.datasets import build_folder, build_loader
from pyretri.models import build_model
from pyretri.extract import build_extract_helper
from torchvision import models
def parse_args():
parser = argparse.ArgumentPa... | null |
1,054 | import argparse
import os
from pyretri.extract.utils import split_dataset
def parse_args():
parser = argparse.ArgumentParser(description='A tool box for deep learning-based image retrieval')
parser.add_argument('opts', default=None, nargs=argparse.REMAINDER)
parser.add_argument('--dataset', '-d', default=N... | null |
1,055 | import argparse
import os
from PIL import Image
import numpy as np
from pyretri.config import get_defaults_cfg, setup_cfg
from pyretri.datasets import build_transformers
from pyretri.models import build_model
from pyretri.extract import build_extract_helper
from pyretri.index import build_index_helper, feature_loader
... | null |
1,056 | import argparse
import os
import pickle
from pyretri.config import get_defaults_cfg, setup_cfg
from pyretri.index import build_index_helper, feature_loader
from pyretri.evaluate import build_evaluate_helper
def parse_args():
parser = argparse.ArgumentParser(description='A tool box for deep learning-based image ret... | null |
1,057 | import argparse
from pyretri.extract import make_data_json
def parse_args():
parser = argparse.ArgumentParser(description='A tool box for deep learning-based image retrieval')
parser.add_argument('opts', default=None, nargs=argparse.REMAINDER)
parser.add_argument('--dataset', '-d', default=None, type=str, ... | null |
1,058 |
async def async_test(_douyin_url: str = None, _tiktok_url: str = None, _bilibili_url: str = None,
_ixigua_url: str = None, _kuaishou_url: str = None) -> None:
# 异步测试/Async test
start_time = time.time()
print("<异步测试/Async test>")
print('\n------------------------------------------... | null |
1,059 | import configparser
config = configparser.ConfigParser()
config_path = 'config.ini'
config.read(config_path, encoding='utf-8')
def api_config():
api_default_port = config.get('Web_API', 'Port')
api_new_port = input(f'Default API port: {api_default_port}\nIf you want use different port input new API port here: ... | null |
1,060 | import configparser
config = configparser.ConfigParser()
config_path = 'config.ini'
config.read(config_path, encoding='utf-8')
def app_config():
app_default_port = config.get('Web_APP', 'Port')
app_new_port = input(f'Default App port: {app_default_port}\nIf you want use different port input new App port here: ... | null |
1,061 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | Root path info. |
1,062 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage - 获取抖音用户单个视频数据,参数是视频链接|分享口令 - Get the data of a single video of a Douyin user, the parameter is the video link. ## 参数/Parameter #### douyin_video_url(选填/Optional): - 视频链接。| 分享口令 - The video link.| Share code - 例子/Example: `https://www.douyin.com/video/7153585499477757192` `https://v.douyin.com/MkmSwy7/` ###... |
1,063 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage - 获取抖音直播视频数据,参数是视频链接|分享口令 - Get the data of a Douyin live video, the parameter is the video link. ## 失效待修复/Waiting for repair |
1,064 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage - 获取抖音用户主页数据,参数是用户链接|ID - Get the data of a Douyin user profile, the parameter is the user link or ID. ## 参数/Parameter tikhub_token: https://api.tikhub.io/#/Authorization/login_for_access_token_user_login_post |
1,065 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage - 获取抖音用户喜欢的视频数据,参数是用户链接|ID - Get the data of a Douyin user profile liked videos, the parameter is the user link or ID. ## 参数/Parameter tikhub_token: https://api.tikhub.io/#/Authorization/login_for_access_token_user_login_post |
1,066 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage - 获取抖音视频评论数据,参数是视频链接|分享口令 - Get the data of a Douyin video comments, the parameter is the video link. ## 参数/Parameter tikhub_token: https://api.tikhub.io/#/Authorization/login_for_access_token_user_login_post |
1,067 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage - 获取单个视频数据,参数是视频链接| 分享口令。 - Get single video data, the parameter is the video link. ## 参数/Parameter #### tiktok_video_url(选填/Optional): - 视频链接。| 分享口令 - The video link.| Share code - 例子/Example: `https://www.tiktok.com/@evil0ctal/video/7156033831819037994` `https://vm.tiktok.com/TTPdkQvKjP/` #### video_id(选填... |
1,068 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage - 获取抖音用户主页数据,参数是用户链接|ID - Get the data of a Douyin user profile, the parameter is the user link or ID. ## 参数/Parameter tikhub_token: https://api.tikhub.io/#/Authorization/login_for_access_token_user_login_post |
1,069 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage - 获取抖音用户主页点赞视频数据,参数是用户链接|ID - Get the data of a Douyin user profile liked video, the parameter is the user link or ID. ## 参数/Parameter tikhub_token: https://api.tikhub.io/#/Authorization/login_for_access_token_user_login_post |
1,070 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | null |
1,071 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage ### [中文] - 将[抖音|TikTok]链接作为参数提交至此端点,返回[视频|图片]文件下载请求。 ### [English] - Submit the [Douyin|TikTok] link as a parameter to this endpoint and return the [video|picture] file download request. # 参数/Parameter - url:str -> [Douyin|TikTok] [视频|图片] 链接/ [Douyin|TikTok] [video|image] link - prefix: bool -> [True/False]... |
1,072 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | 批量下载文件端点/Batch download file endpoint 未完工/Unfinished |
1,073 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage ### [中文] - 将抖音域名改为当前服务器域名即可调用此端点,返回[视频|图片]文件下载请求。 - 例如原链接:https://www.douyin.com/discover?modal_id=1234567890123456789 改成 https://api.douyin.wtf/discover?modal_id=1234567890123456789 即可调用此端点。 ### [English] - Change the Douyin domain name to the current server domain name to call this endpoint and return the... |
1,074 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | ## 用途/Usage ### [中文] - 将TikTok域名改为当前服务器域名即可调用此端点,返回[视频|图片]文件下载请求。 - 例如原链接:https://www.tiktok.com/@evil0ctal/video/7156033831819037994 改成 https://api.douyin.wtf/@evil0ctal/video/7156033831819037994 即可调用此端点。 ### [English] - Change the TikTok domain name to the current server domain name to call this endpoint and return t... |
1,075 | import json
import aiohttp
import uvicorn
import zipfile
import threading
import configparser
from fastapi import FastAPI, Request
from fastapi.responses import ORJSONResponse, FileResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import ge... | null |
1,076 |
def valid_check(input_data: str) -> str or None:
# 检索出所有链接并返回列表/Retrieve all links and return a list
url_list = find_url(input_data)
# 总共找到的链接数量/Total number of links found
total_urls = len(url_list)
if total_urls == 0:
return t('没有检测到有效的链接,请检查输入的内容是否正确。',
'No valid link d... | null |
1,077 |
def error_do(reason: str, value: str) -> None:
# 输出一个毫无用处的信息
put_html("<hr>")
put_error(
t("发生了了意料之外的错误,输入值已被记录。", "An unexpected error occurred, the input value has been recorded."))
put_html('<h3>⚠{}</h3>'.format(t('详情', 'Details')))
put_table([
[t('原因', 'reason'), t('输入值', 'inpu... | null |
1,078 |
def ios_pop_window():
with popup(t("iOS快捷指令", "iOS Shortcut")):
version = config["Web_API"]["iOS_Shortcut_Version"]
update = config["Web_API"]['iOS_Shortcut_Update_Time']
link = config["Web_API"]['iOS_Shortcut_Link']
link_en = config["Web_API"]['iOS_Shortcut_Link_EN']
note ... | null |
1,079 |
def api_document_pop_window():
with popup(t("API文档", "API Document")):
put_markdown(t("💾TikHub_API文档", "💾TikHub_API Document"))
put_markdown(t('TikHub_API 支持抖音和TikTok的更多接口, 如主页解析,视频解析,视频评论解析,个人点赞列表解析等...',
'TikHub_API supports more interfaces of Douyin and TikTok, such as ... | null |
1,080 |
def log_popup_window():
with popup(t('错误日志', 'Error Log')):
put_html('<h3>⚠️{}</h3>'.format('关于解析失败可能的原因', 'About the possible reasons for parsing failure'))
put_markdown(t('服务器可能被目标主机的防火墙限流(稍等片刻后再次尝试)',
'The server may be limited by the target host firewall (try again after... | null |
1,081 |
def about_popup_window():
with popup(t('更多信息', 'More Information')):
put_html('<h3>👀{}</h3>'.format(t('访问记录', 'Visit Record')))
put_image('https://views.whatilearened.today/views/github/evil0ctal/TikTokDownload_PyWebIO.svg',
title='访问记录')
put_html('<hr>')
put_htm... | null |
1,082 | import matplotlib.pyplot as plt
import pandas as pd
import os
import json
from matplotlib.ticker import MaxNLocator
import matplotlib.font_manager as fm
from lab_gpt4_call import send_chat_request,send_chat_request_Azure,send_official_call
import re
from tool import *
import tiktoken
import concurrent.futures
import da... | null |
1,083 | import matplotlib.pyplot as plt
import pandas as pd
import os
import json
from matplotlib.ticker import MaxNLocator
import matplotlib.font_manager as fm
from lab_gpt4_call import send_chat_request,send_chat_request_Azure,send_official_call
import re
from tool import *
import tiktoken
import concurrent.futures
import da... | null |
1,084 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | This function takes a date string in the format YYYYMMDD and returns the date string one year prior to the input date. Args: - date_str: string, the input date in the format YYYYMMDD Returns: - string, the date one year prior to the input date in the format YYYYMMDD |
1,085 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Retrieves the daily technical data of a stock including macd turnover rate, volume, PE ratio, etc. Those technical indicators are usually plotted as subplots in a k-line chart. Args: stock_name (str): start_date (str): Start date "YYYYMMDD" end_date (str): End date "YYYYMMDD" Returns: pd.DataFrame: A DataFrame containi... |
1,086 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | This function plots stock data. Args: - stock_data: pandas DataFrame, the stock data to plot. The DataFrame should contain three columns: - Column 1: trade date in 'YYYYMMDD' - Column 2: Stock name or code (string format) - Column 3: Index value (numeric format) The DataFrame can be time series data or cross-sectional ... |
1,087 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Retrieves information about a fund manager. Args: Manager_name (str): The name of the fund manager. Returns: df (DataFrame): A DataFrame containing the fund manager's information, including the fund codes, announcement dates, manager's name, gender, birth year, education, nationality, start and end dates of managing fu... |
1,088 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Calculate a specific index of a stock based on its price information. Args: stock_data (pd.DataFrame): DataFrame containing the stock's price information. index (str, optional): The index to calculate. The available options depend on the column names in the input stock price data. Additionally, there are two special in... |
1,089 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Sort the cross-sectional data based on the given index. Args: stock_data : DataFrame containing the cross-sectional data. It should have three columns, and the last column represents the variable to be sorted. Top_k : The number of data points to retain after sorting. (Default: -1, which retains all data points) ascend... |
1,090 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | This function retrieves company information including stock code, exchange, chairman, manager, secretary, registered capital, setup date, province, city, website, email, employees, business scope, main business, introduction, office, and announcement date. Args: - stock_name (str): The name of the stock. Returns: - pd.... |
1,091 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Retrieves the financial data for a given stock within a specified date range. Args: stock_name (str): The stock code. start_date (str): The start date of the data range in the format "YYYYMMDD". end_date (str): The end date of the data range in the format "YYYYMMDD". financial_index (str, optional): The financial indic... |
1,092 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Retrieves GDP data for the chosen index and specified time period. Args: - start_quarter (str): The start quarter of the query, in YYYYMMDD format. - end_quarter (str): The end quarter, in YYYYMMDD format. - index (str): The specific GDP index to retrieve. Default is `gdp_yoy`. Returns: - pd.DataFrame: A pandas DataFra... |
1,093 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | This function is used to retrieve China's monthly CPI (Consumer Price Index), PPI (Producer Price Index), and monetary supply data published by the National Bureau of Statistics, and return a DataFrame table containing month, country, and index values. The function parameters include start month, end month, query type,... |
1,094 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Predict the next n values of a specific column in the DataFrame using linear regression. Parameters: df (pandas.DataFrame): The input DataFrame. pred_index (str): The name of the column to predict. pred_num (int): The number of future values to predict. Returns: pandas.DataFrame: The DataFrame with the predicted values... |
1,095 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Retrieves the latest news data from major news websites, including Sina Finance, 10jqka, Eastmoney, and Yuncaijing. Args: src (str): The name of the news website. Default is 'sina'. Optional parameters include: 'sina' for Sina Finance, '10jqka' for 10jqka, 'eastmoney' for Eastmoney, and 'yuncaijing' for Yuncaijing. Ret... |
1,096 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Query the constituent stocks of basic index (中证500) or a specified SW (申万) industry index args: index_name: the name of the index. start_date: the start date in "YYYYMMDD". end_date: the end date in "YYYYMMDD". return: A pandas DataFrame containing the following columns: index_code index_name stock_code: the code of th... |
1,097 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Calculates the rate of return for a specified stock/fund between two dates. Args: stock_name: stock_name or fund_name start_date end_date index (str): The index used to calculate the stock return, including 'open' and 'close'. Returns: float: The rate of return for the specified stock between the two dates. |
1,098 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | It iteratively applies the given function to each row and get a result using function. It then stores the calculated result in 'new_feature' column. Args: df: DataFrame with a single column func : The function to be applied to each row: func(row, *args, **kwargs) *args: Additional positional arguments for `func` functi... |
1,099 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | null |
1,100 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Calculates the weighted mean of a column and returns the result as a float. Args: data (pd.DataFrame): The input cross-sectional or time-series data containing the feature columns. col (str): The name of the feature column to calculate the weighted mean for. weight_col (pd.Series): The weights used for the calculation,... |
1,101 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | This function retrieves daily, weekly, or monthly data for a given stock index. Arguments: - index_name: Name of the index - start_date: Start date in 'YYYYMMDD' - end_date: End date in 'YYYYMMDD' - freq: Frequency 'daily', 'weekly', or 'monthly' Returns: A DataFrame containing the following columns: trade_date, ts_cod... |
1,102 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | null |
1,103 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Plots a K-line chart of stock price and volume. Args: stock_data : A pandas DataFrame containing the stock price information, in which each row represents a daily record. The DataFrame must contain the 'trade_date','open', 'close', 'high', 'low','volume', 'name' columns, which is used for k-line and volume. 如果dataframe... |
1,104 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Retrieves information about a fund based on the fund code. Args: fund_code (str, optional): Fund code. Defaults to ''. Returns: df (DataFrame): A DataFrame containing various information about the fund, including fund code, fund name, management company, custodian company, investment type, establishment date, maturity ... |
1,105 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | It prints the dataframe as a formatted table using the PrettyTable library and saves it to a CSV file at the specified file path. Args: - df: the dataframe to be printed and saved to a CSV file - title_name: the name of the table to be printed and saved - save: whether to save the table to a CSV file - file_path: the f... |
1,106 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Merges two DataFrames (two indicators of the same stock) based on common names for same stock. Data from two different stocks cannot be merged Args: df1: DataFrame contains some indicators for stock A. df2: DataFrame contains other indicators for stock A. Returns: pd.DataFrame: The merged DataFrame contains two differe... |
1,107 | import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd
import os
import random
from matplotlib.ticker import MaxNLocator
import time
from datetime import datetime, timedelta
import numpy as np
import mplfinance as mpf
from typing import Optional
import matplotlib.font_manager as fm
from matplotlib.lin... | Selects a specific column or a specific value within a DataFrame. Args: df1: The input DataFrame. col_name: The name of the column to be selected. row_index: The index of the row to be selected. Returns: Union[pd.DataFrame, Any]. row_index=-1: df1[col_name].to_frame() or df1[col_name][row_index] |
1,108 | import gradio as gr
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from io import BytesIO
from main import run, add_to_queue,gradio_interface
import io
import sys
import time
import os
import pandas as pd
"""
# Hello Data-Copilot ! 😀
A powerful AI system connects human... | null |
1,109 | import gradio as gr
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from io import BytesIO
from main import run, add_to_queue,gradio_interface
import io
import sys
import time
import os
import pandas as pd
def set_key(state, openai_api_key,openai_api_key_azure, openai_api_base_azure, openai_ap... | null |
1,110 | import gradio as gr
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from io import BytesIO
from main import run, add_to_queue,gradio_interface
import io
import sys
import time
import os
import pandas as pd
def run(state, chatbot):
generator = state["client"].run(chatbot)
for s... | null |
1,111 | import json
import requests
import openai
import tiktoken
import os
import time
from functools import wraps
import threading
The provided code snippet includes necessary dependencies for implementing the `retry` function. Write a Python function `def retry(exception_to_check, tries=3, delay=5, backoff=1)` to solve the... | Decorator used to automatically retry a failed function. Parameters: exception_to_check: The type of exception to catch. tries: Maximum number of retry attempts. delay: Waiting time between each retry. backoff: Multiplicative factor to increase the waiting time after each retry. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.