Skip to content

Instantly share code, notes, and snippets.

from glue.config import importer, settings
from glue.core import Data
from glue.core import DataCollection
from qtpy import QtGui
from qtpy.QtWidgets import QWidget, QInputDialog, QLineEdit
import numpy as np
# TODO: write a test code
@PennyQ
PennyQ / fasttext_wrapper.py
Last active September 22, 2021 18:21
A wrapper example for fasttext models in MLflow
import fasttext
import mlflow.pyfunc
class FastTextWrapper(mlflow.pyfunc.PythonModel):
"""
Class to train and use FastText Models
"""
def load_context(self, context):
@PennyQ
PennyQ / my_dag.py
Created July 29, 2021 14:43
stock filter DAG Airflow
from airflow import DAG
from airflow.operators.python import PythonOperator, PythonVirtualenvOperator, BranchPythonOperator
from airflow.operators.bash import BashOperator
from datetime import datetime
def choose_stock(ti):
data = ti.xcom_pull(task_ids="download_yf")
spy_data = data['Close']['SPY']
# Repo: MySpace/TemplateRepo
# File: azure-pipeline.yml
name: cicd_ci
trigger:
branches:
include:
- master
# Repo: MySpace/TemplateRepo
# File: ci_template.yml
jobs:
- job:
displayName: yamllint_checks
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
# Repo: MySpace/UserRepo
# File: azure-pipeline2.yml
name: cicd_ci
trigger:
branches:
include:
- master
# Repo: MySpace/UserRepo
# File: azure-pipeline3.yml
name: cicd_ci
trigger:
branches:
include:
- master
# Repo: MySpace/TemplateRepo
# File: ci_template.yml
parameters:
- name: pylint_threshold
type: string
default: 8.0
- name: lint_folder
type: string
default: "mockcase-on-test"
# Repo: MySpace/UserRepo
# File: azure-pipeline3.yml
name: cicd_ci
variables:
- name: PylintThreshold
value: 8.0
- name: LintFolder
value: "folder_dir"
import fasttext
import mlflow
from .fast_text_wrapper import FastTextWrapper
def save_model(
df: pd.DataFrame,
model_name: str = "model_name",
corpus_filename: str = "prepared_corpus",
prepared_content: str = "prepared_text",
):