Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
PelumiAdeboye authored Jun 3, 2023
1 parent eb72d24 commit cea4fb8
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 0 deletions.
39 changes: 39 additions & 0 deletions manual_rps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import random


def get_computer_choice():
options = ["Rock", "Paper", "Scissors"]
return random.choice(options)


def get_user_choice():
while True:
user_choice = input("Choose Rock, Paper, or Scissors: ").capitalize()
if user_choice in ["Rock", "Paper", "Scissors"]:
return user_choice
else:
print("Invalid choice. Please try again.")


def get_winner(computer_choice, user_choice):
if computer_choice == user_choice:
print("It is a tie!")
elif (
(computer_choice == "Rock" and user_choice == "Scissors") or
(computer_choice == "Paper" and user_choice == "Rock") or
(computer_choice == "Scissors" and user_choice == "Paper")
):
print("You lost!")
else:
print("You won!")


def play():
computer_choice = get_computer_choice()
user_choice = get_user_choice()
get_winner(computer_choice, user_choice)


# Call the play function to start the game
play()

79 changes: 79 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Package Version
---------------------------- --------
absl-py 1.4.0
asttokens 2.2.1
astunparse 1.6.3
backcall 0.2.0
cachetools 5.3.1
certifi 2023.5.7
charset-normalizer 3.1.0
colorama 0.4.6
comm 0.1.3
debugpy 1.6.7
decorator 5.1.1
executing 1.2.0
flatbuffers 23.5.26
gast 0.4.0
google-auth 2.19.1
google-auth-oauthlib 1.0.0
google-pasta 0.2.0
grpcio 1.54.2
h5py 3.8.0
idna 3.4
ipykernel 6.23.1
ipython 8.14.0
jax 0.4.11
jedi 0.18.2
jupyter_client 8.2.0
jupyter_core 5.3.0
keras 2.12.0
libclang 16.0.0
Markdown 3.4.3
MarkupSafe 2.1.3
matplotlib-inline 0.1.6
ml-dtypes 0.1.0
nest-asyncio 1.5.6
numpy 1.23.5
oauthlib 3.2.2
opencv-python 4.7.0.72
opt-einsum 3.3.0
packaging 23.1
pandas 2.0.2
parso 0.8.3
pickleshare 0.7.5
pip 23.0.1
platformdirs 3.5.1
prompt-toolkit 3.0.38
protobuf 4.23.2
psutil 5.9.5
pure-eval 0.2.2
pyasn1 0.5.0
pyasn1-modules 0.3.0
Pygments 2.15.1
python-dateutil 2.8.2
pytz 2023.3
pywin32 306
pyzmq 25.1.0
requests 2.31.0
requests-oauthlib 1.3.1
rsa 4.9
scipy 1.10.1
setuptools 67.8.0
six 1.16.0
stack-data 0.6.2
tensorboard 2.12.3
tensorboard-data-server 0.7.0
tensorflow 2.12.0
tensorflow-estimator 2.12.0
tensorflow-intel 2.12.0
tensorflow-io-gcs-filesystem 0.31.0
termcolor 2.3.0
tornado 6.3.2
traitlets 5.9.0
typing_extensions 4.6.3
tzdata 2023.3
urllib3 1.26.16
wcwidth 0.2.6
Werkzeug 2.3.4
wheel 0.38.4
wrapt 1.14.1
24 changes: 24 additions & 0 deletions testing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import cv2
from keras.models import load_model
import numpy as np
model = load_model('keras_model.h5')
cap = cv2.VideoCapture(0)
data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)

while True:
ret, frame = cap.read()
resized_frame = cv2.resize(frame, (224, 224), interpolation = cv2.INTER_AREA)
image_np = np.array(resized_frame)
normalized_image = (image_np.astype(np.float32) / 127.0) - 1 # Normalize the image
data[0] = normalized_image
prediction = model.predict(data)
cv2.imshow('frame', frame)
# Press q to close the window
print(prediction)
if cv2.waitKey(1) & 0xFF == ord('q'):
break

# After the loop release the cap object
cap.release()
# Destroy all the windows
cv2.destroyAllWindows()

0 comments on commit cea4fb8

Please sign in to comment.