Skip to content

Instantly share code, notes, and snippets.

View kingabzpro's full-sized avatar
🦊
Hunting

Abid Ali Awan kingabzpro

🦊
Hunting
View GitHub Profile
@kingabzpro
kingabzpro / weighted_average.py
Last active October 14, 2022 09:29
Ensemble Learning with examples: Weighted Average
pred_final = np.round(0.3*pred_1 + 0.6*pred_2 + 0.1*pred_3)
# evalution
accuracy = round(accuracy_score(y_test, pred_final) * 100, 3)
auc = round(roc_auc_score(y_test, pred_final), 3)
print(f" Accuracy: {accuracy}%")
print(f" AUC score: {auc}")
@kingabzpro
kingabzpro / import.py
Last active October 14, 2022 09:27
Ensemble Learning with examples
# Utility
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score,accuracy_score
from sklearn.preprocessing import StandardScaler
# machine learning
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression, SGDClassifier
@kingabzpro
kingabzpro / list_tqdm.py
Last active August 15, 2022 14:37
List tqdm exmaple
from tqdm.notebook import tqdm
colors = ["Blue","Green","Yellow","White","Gray","Black"]
for x in tqdm(colors):
sleep(1)
print(x)
@kingabzpro
kingabzpro / epochs_tqdm.py
Last active August 15, 2022 14:37
tqdm progress in notebook
from tqdm.notebook import trange
for i in trange(10, desc='Traning Model on 10 Epochs'):
sleep(0.01)
for x in trange(10000, desc=f'Epoch {i}'):
sleep(0.001)
@kingabzpro
kingabzpro / callback.py
Created February 24, 2022 16:43
Deploying Gradio App on Spaces Using DagsHub
HF_TOKEN = os.getenv("HF_TOKEN")
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "savtadepth-flags")
iface = gr.Interface(
gen,
gr.inputs.Image(shape=(640, 480), type="numpy"),
"image",
title=title,
description=description,
article=article,
@kingabzpro
kingabzpro / push.sh
Created February 24, 2022 16:41
Deploying Gradio App on Spaces Using DagsHub
git add .
git commit -m "first commit to HF Spaces"
git push gradio master:main -f
@kingabzpro
kingabzpro / requirements.txt
Created February 24, 2022 16:40
Deploying Gradio App on Spaces Using DagsHub
-f https://download.pytorch.org/whl/cpu/torch_stable.html
dvc==2.9.5
fastai==2.5.3
torch==1.10.2+cpu
gradio==2.8.1
@kingabzpro
kingabzpro / hfmeta.yml
Created February 24, 2022 16:40
Deploying Gradio App on Spaces Using DagsHub
---
title: Monocular Depth Estimation
emoji: 🛋
colorFrom: gray
colorTo: yellow
sdk: gradio
app_file: app/app_savta.py
pinned: false
license: mit
---
git remote add gradio https://huggingface.co/spaces/kingabzpro/savtadepth
@kingabzpro
kingabzpro / dvc.py
Created February 24, 2022 16:39
Deploying Gradio App on Spaces Using DagsHub
import os
PROD_MODEL_PATH = "src/models"
TRAIN_PATH = "src/data/processed/train/bathroom"
TEST_PATH = "src/data/processed/test/bathroom"
if os.path.isdir(".dvc"):
print("Running DVC")
os.system("dvc config cache.type copy")
os.system("dvc config core.no_scm true")