27 lines
770 B
Python
27 lines
770 B
Python
|
import numpy as np
|
||
|
#from neural_network import *
|
||
|
from numpy import loadtxt
|
||
|
import pandas as pd
|
||
|
from sklearn.model_selection import train_test_split
|
||
|
import tensorflow as tf
|
||
|
from tensorflow.keras.layers import Dense, Dropout
|
||
|
|
||
|
products = ['glass', 'mixed', 'metal', 'paper']
|
||
|
n_products = len(products)
|
||
|
data = pd.read_csv("X_test.csv")
|
||
|
dff = data.loc[:, data.columns != 'Unnamed: 0']
|
||
|
def b():
|
||
|
a = dff.sample()
|
||
|
pred(a)
|
||
|
|
||
|
model = tf.keras.models.load_model('C:/Users/Natalia/Desktop/lsm04/smieciara/saved_model')
|
||
|
|
||
|
|
||
|
def pred(a):
|
||
|
print(a)
|
||
|
prediction_proba = model.predict(np.array(a))
|
||
|
prediction = np.argmax(prediction_proba)
|
||
|
text_representation = products[prediction]
|
||
|
print(text_representation)
|
||
|
print(prediction)
|
||
|
return prediction
|