This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
section .data | |
pesanSiang: db 'Selamat Siang',10 | |
pesanSiangLen: equ $-pesanSiang | |
pesanPagi: db 'Selamat Pagi',10 | |
pesanPagiLen: equ $-pesanPagi | |
section .text | |
global _start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tensorflow import keras | |
from sklearn.metrics import classification_report | |
import numpy as np | |
# Load data provided by keras | |
data = keras.datasets.mnist | |
(x_train, y_train), (x_test, y_test) = data.load_data() | |
# Create model using sequential API | |
model = keras.Sequential([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package inheritance; | |
public class Dosen extends Pegawai { | |
long gatun = 1000000; | |
void hitungGatun(){ | |
System.out.print("Gaji Tunjangan : "); | |
System.out.println(this.namaPegawai + " " + this.gatun); | |
} | |
void hitungGatot(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import datetime | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import tensorflow as tf | |
keras = tf.keras | |
# Blit function to put text in video | |
def blit(text,frame,color,position=(100, 100)): | |
cv2.putText(frame, text, position, cv2.FONT_HERSHEY_SIMPLEX, 2, color, 4, cv2.LINE_4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def predict(unseen_image = []): | |
test_data = batchData(unseen_image,for_test=True) | |
prediction = model.predict(test_data) | |
for image,pred in zip(unseen_image,prediction): | |
fig,axes = plt.subplots(nrows=1,ncols=2) | |
axes[0].imshow(processImage(image)) | |
axes[0].axis(False) | |
axes[0].set_title('Actual Image') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create early stopping callback | |
early_stopping = keras.callbacks.EarlyStopping(monitor='val_loss',patience=3) | |
# Store model history into variable | |
history = model.fit(train_data,validation_data = valid_data,validation_freq=1,epochs = 50,callbacks = [early_stopping],verbose = 1,) | |
# Plot model training history | |
def plot_history(): | |
plt.plot(history.history['acc'],label='acc') | |
plt.plot(history.history['val_acc'],label='val_acc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create model structure | |
model = keras.Sequential([ | |
# Input Layer | |
keras.layers.Conv2D(input_shape=(224,224,3),filters=32,kernel_size=(3,3),activation='relu'), | |
keras.layers.MaxPooling2D(), | |
# Hidden Layer | |
keras.layers.Conv2D(input_shape=(224,224,3),filters=64,kernel_size=(3,3),activation='relu'), | |
keras.layers.MaxPooling2D(), | |
keras.layers.Conv2D(input_shape=(224,224,3),filters=128,kernel_size=(3,3),activation='relu'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Processing image files into numpy array | |
def process_label(label): | |
label = [i == unique_label for i in label] | |
label = np.array(label).astype(int) | |
return label | |
def processImage(path): | |
image = tf.io.read_file(path) | |
image = tf.image.decode_jpeg(image,channels=3) | |
image = tf.image.convert_image_dtype(image,tf.float32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import tensorflow as tf | |
keras = tf.keras |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
with open('AI_DrugClassifier.pkl','rb') as file: | |
model = pickle.load(file) | |
def self_prediction(): | |
age = input('Age : ') | |
sex = input('Sex : ') | |
bp = input('BP : ') | |
chol = input('Cholesterol : ') |
NewerOlder