Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ learn = load_learner('rps_model.pkl')
|
|
11 |
|
12 |
categories = ('paper', 'rock', 'scissors')
|
13 |
|
14 |
-
def
|
15 |
pred, idx, probs = learn.predict(img)
|
16 |
return dict(zip(categories, map(float, probs)))
|
17 |
|
@@ -24,7 +24,7 @@ def determine_winner(user_choice, computer_choice):
|
|
24 |
return "Computer won!"
|
25 |
|
26 |
def play_game(img):
|
27 |
-
user_probs =
|
28 |
user_choice = max(user_probs, key=user_probs.get)
|
29 |
computer_choice = random.choice(categories)
|
30 |
winner = determine_winner(user_choice, computer_choice)
|
|
|
11 |
|
12 |
categories = ('paper', 'rock', 'scissors')
|
13 |
|
14 |
+
def classify_image(img):
|
15 |
pred, idx, probs = learn.predict(img)
|
16 |
return dict(zip(categories, map(float, probs)))
|
17 |
|
|
|
24 |
return "Computer won!"
|
25 |
|
26 |
def play_game(img):
|
27 |
+
user_probs = classify_image(img)
|
28 |
user_choice = max(user_probs, key=user_probs.get)
|
29 |
computer_choice = random.choice(categories)
|
30 |
winner = determine_winner(user_choice, computer_choice)
|