Skip to content

Instantly share code, notes, and snippets.

View thuwarakeshm's full-sized avatar

Thuwarakesh Murallie thuwarakeshm

View GitHub Profile
from django.urls import path
from views import sum_odd_numbers
urlpatterns = [
path("sum_odd_numbers/<int:n>", sum_odd_numbers),
]
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
def window():
app = QApplication(sys.argv)
widget = QWidget()
textLabel = QLabel(widget)
from aim.sdk.adapters.keras import AimCallback
model.fit(x_train, y_train, epochs=epochs, callbacks=[
AimCallback(repo='/path/to/logs/dir', experiment='experiment_name')
])
@thuwarakeshm
thuwarakeshm / convert.py
Last active February 19, 2023 09:59
deploy ml
import tensorflow as tf
# create and train a keras neural network
classifier = tf.keras.models.Sequential([
tf.keras.layers.Dense(units=1, input_shape=[1]),
tf.keras.layers.Dense(units=28, activation='relu'),
tf.keras.layers.Dense(units=1)
])
classifier.compile(optimizer='sgd', loss='mean_squared_error')
classifier.fit(x=[-1, 0, 1], y=[-3, -1, 1], epochs=5)
# trainable property is available on model instances
model.trainable = False
# Also on individual layers
layer.trainable = False
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: requirements-txt-fixer
Virtualenv Poetry
virtualenv env poetry init --no-interaction
@thuwarakeshm
thuwarakeshm / app.py
Last active April 14, 2022 10:02
Dash app
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash_html_components.Label import Label
from pandas.io.formats import style
import plotly.express as px
import pandas as pd
from dash.dependencies import Input, Output
app = dash.Dash(
@thuwarakeshm
thuwarakeshm / config.toml
Last active August 15, 2021 14:11
ETL with Prefect
[context.secrets]
EMAIL_USERNAME = "<Your email id>"
EMAIL_PASSWORD = "<your email password>"
@thuwarakeshm
thuwarakeshm / compare_with_target.py
Last active August 14, 2021 10:26
Analysis in a blink
@app.command()
def compare_with_target(input1: str, input2: str, target: str):
# Read CSVs from arguments
df1, df2 = pd.read_csv(input1), pd.read_csv(input2)
# Generate a comparison report against the target variable
report = sv.compare(df1, df2, target)
# Render HTML report in your default browser