import time
from svd import *
from huffman import *

#main
namaimg = input("Masukkan path file gambar(in/): ")
print("Pilih algoritma:")
print("1. SVD")
print("2. Huffman")
try:
    alg = int(input("Input(1/2): "))
    if alg == 1:
        valid = False
        try:
            k = int(input("Masukkan tingkat kompresi-> \nPilih jumlah singular values: "))
            if k >=1:
                valid = True
            else:
                print("Jumlah singular value minimal 1")
        except:
            print("Error Input")
        if valid:
            start = time.time()
            print(svd(namaimg, k))
            end = time.time()
            print("Runtime program: " + "{:.3f}".format(end - start) + " detik")
    elif alg == 2:
        start = time.time()
        print(huffman(namaimg))
        end = time.time()
        print("Runtime program: " + "{:.3f}".format(end - start) + " detik")
    else:
        print("Error Input")
except:
    print("Error Input")










    
    






c38d3e642ef6743e22783c6a220c696cf2066708
<mask token>

<mask token>
print('Pilih algoritma:')
print('1. SVD')
print('2. Huffman')
try:
    alg = int(input('Input(1/2): '))
    if alg == 1:
        valid = False
        try:
            k = int(input(
                'Masukkan tingkat kompresi-> \nPilih jumlah singular values: ')
                )
            if k >= 1:
                valid = True
            else:
                print('Jumlah singular value minimal 1')
        except:
            print('Error Input')
        if valid:
            start = time.time()
            print(svd(namaimg, k))
            end = time.time()
            print('Runtime program: ' + '{:.3f}'.format(end - start) + ' detik'
                )
    elif alg == 2:
        start = time.time()
        print(huffman(namaimg))
        end = time.time()
        print('Runtime program: ' + '{:.3f}'.format(end - start) + ' detik')
    else:
        print('Error Input')
except:
    print('Error Input')

<mask token>
namaimg = input('Masukkan path file gambar(in/): ')
print('Pilih algoritma:')
print('1. SVD')
print('2. Huffman')
try:
    alg = int(input('Input(1/2): '))
    if alg == 1:
        valid = False
        try:
            k = int(input(
                'Masukkan tingkat kompresi-> \nPilih jumlah singular values: ')
                )
            if k >= 1:
                valid = True
            else:
                print('Jumlah singular value minimal 1')
        except:
            print('Error Input')
        if valid:
            start = time.time()
            print(svd(namaimg, k))
            end = time.time()
            print('Runtime program: ' + '{:.3f}'.format(end - start) + ' detik'
                )
    elif alg == 2:
        start = time.time()
        print(huffman(namaimg))
        end = time.time()
        print('Runtime program: ' + '{:.3f}'.format(end - start) + ' detik')
    else:
        print('Error Input')
except:
    print('Error Input')

import time
from svd import *
from huffman import *
namaimg = input('Masukkan path file gambar(in/): ')
print('Pilih algoritma:')
print('1. SVD')
print('2. Huffman')
try:
    alg = int(input('Input(1/2): '))
    if alg == 1:
        valid = False
        try:
            k = int(input(
                'Masukkan tingkat kompresi-> \nPilih jumlah singular values: ')
                )
            if k >= 1:
                valid = True
            else:
                print('Jumlah singular value minimal 1')
        except:
            print('Error Input')
        if valid:
            start = time.time()
            print(svd(namaimg, k))
            end = time.time()
            print('Runtime program: ' + '{:.3f}'.format(end - start) + ' detik'
                )
    elif alg == 2:
        start = time.time()
        print(huffman(namaimg))
        end = time.time()
        print('Runtime program: ' + '{:.3f}'.format(end - start) + ' detik')
    else:
        print('Error Input')
except:
    print('Error Input')

import time
from svd import *
from huffman import *

#main
namaimg = input("Masukkan path file gambar(in/): ")
print("Pilih algoritma:")
print("1. SVD")
print("2. Huffman")
try:
    alg = int(input("Input(1/2): "))
    if alg == 1:
        valid = False
        try:
            k = int(input("Masukkan tingkat kompresi-> \nPilih jumlah singular values: "))
            if k >=1:
                valid = True
            else:
                print("Jumlah singular value minimal 1")
        except:
            print("Error Input")
        if valid:
            start = time.time()
            print(svd(namaimg, k))
            end = time.time()
            print("Runtime program: " + "{:.3f}".format(end - start) + " detik")
    elif alg == 2:
        start = time.time()
        print(huffman(namaimg))
        end = time.time()
        print("Runtime program: " + "{:.3f}".format(end - start) + " detik")
    else:
        print("Error Input")
except:
    print("Error Input")










    
    





