Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# List of names | |
friends = ['Sachin', 'Rishu', 'Yashwant'] | |
# Printing the original list | |
print('Original List:', friends) | |
# Appending an element | |
friends.append('Abhishek') | |
# Printing the updated list | |
print('New List: ', friends) |
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
# List of names | |
friends = ['Sachin', 'Rishu', 'Yashwant'] | |
# Printing the original list | |
print('Original List:', friends) | |
# Using extend() to extend the list | |
friends.extend(['Yogesh', 'Abhishek']) | |
# Printing the updated list | |
print('New List: ', friends) |
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
# List of names | |
friends = ['Sachin', 'Rishu', 'Yashwant'] | |
# Printing the original list | |
print('Original List:', friends) | |
# Inserting an element | |
friends.insert(1, 'Abhishek') | |
# Printing the updated list | |
print('New List: ', friends) |
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
''' | |
A Python program to adopt a pet and appending the details in a file. | |
The entry can also be viewed by reading the file | |
''' | |
import datetime | |
# Defining main function | |
def get_pet(pet): |
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
img_input = input("Enter the path of an image: ") | |
display_and_predict(img_input) |
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 numpy as np | |
import matplotlib.pyplot as plt | |
from PIL import 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
# Function to display and predicting the Image | |
def display_and_predict(img_path_input): | |
display_img = Image.open(img_path_input) | |
plt.imshow(display_img) | |
plt.show() | |
img = preprocess_img(img_path_input) | |
pred = predict_result(img) | |
print("Prediction: ", pred) |
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
img_input = input("Enter the path of an image: ") | |
display_and_predict(img_input) |
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_result(predict): | |
pred = my_model.predict(predict) | |
return np.argmax(pred[0], axis=-1) |
NewerOlder