Skip to content

Instantly share code, notes, and snippets.

View thuwarakeshm's full-sized avatar

Thuwarakesh Murallie thuwarakeshm

View GitHub Profile
@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(
Virtualenv Poetry
virtualenv env poetry init --no-interaction
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: requirements-txt-fixer
# trainable property is available on model instances
model.trainable = False
# Also on individual layers
layer.trainable = False
@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)
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')
])
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 django.urls import path
from views import sum_odd_numbers
urlpatterns = [
path("sum_odd_numbers/<int:n>", sum_odd_numbers),
]
@thuwarakeshm
thuwarakeshm / customcode.py
Last active December 17, 2021 14:55
Python comments, why they are important?
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
# Your app
"myawesomeapp",
]
from pipe import chain
nested_list = [[1, 2, 3], [4, 5, 6], [7, [8, 9]]]
unfolded_list = list(nested_list
| chain
)
print(unfolded_list)