Uploaded model and app.py
Browse files
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
title: Footballer Profile Predictor
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: red
|
| 6 |
sdk: streamlit
|
|
|
|
| 1 |
---
|
| 2 |
title: Footballer Profile Predictor
|
| 3 |
+
emoji: ⚽🧔🏽♂️
|
| 4 |
colorFrom: pink
|
| 5 |
colorTo: red
|
| 6 |
sdk: streamlit
|
app.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
from fastbook import *
|
| 4 |
+
from PIL import Image
|
| 5 |
+
|
| 6 |
+
@st.cache_data
|
| 7 |
+
learn = load_learner('model.pkl')
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
title = ':red[Upload Your Image And See which 2022 FIFA WC Football Player You Look Like]! ⚽ 🧔🏽'
|
| 11 |
+
|
| 12 |
+
st.title(title)
|
| 13 |
+
st.divider()
|
| 14 |
+
with st.container():
|
| 15 |
+
st.header('You can upload your image below using one of the following two options:')
|
| 16 |
+
col1, col2 = st.columns(2)
|
| 17 |
+
with col1:
|
| 18 |
+
st.subheader('1. Upload an Image:')
|
| 19 |
+
upload_image = st.file_uploader(label='Local', type=['png', 'jpg', 'jpeg'])
|
| 20 |
+
with col2:
|
| 21 |
+
st.subheader('2. Take a Picture: ')
|
| 22 |
+
webcam_image = st.camera_input(label='Webcam')
|
| 23 |
+
|
| 24 |
+
with st.container():
|
| 25 |
+
if (upload_image):
|
| 26 |
+
output = st.image(upload_image)
|
| 27 |
+
st.subheader("That's a lovely picture! let's proceed to see who you look like...")
|
| 28 |
+
elif (webcam_image):
|
| 29 |
+
output = st.image(webcam_image)
|
| 30 |
+
st.subheader("That's a lovely picture! let's proceed to see who you look like...")
|
| 31 |
+
else:
|
| 32 |
+
output = st.header('Please upload an image to proceed...')
|
| 33 |
+
|
| 34 |
+
with st.container():
|
| 35 |
+
def classify(output):
|
| 36 |
+
name, _, _ = learn.predict(output)
|
| 37 |
+
return name
|
| 38 |
+
button = st.button('Click to see who you look like!', help='Click Me!')
|
| 39 |
+
if button:
|
| 40 |
+
with st.spinner():
|
| 41 |
+
name = classify()
|
| 42 |
+
urls = search_images_ddg(name, max_images=2)
|
| 43 |
+
img = download_url(urls[0])
|
| 44 |
+
im = Image.open(img)
|
| 45 |
+
im = im.thumbnail(720,576))
|
| 46 |
+
st.header(f'Congratulations! You Look Like: {name}!!')
|
| 47 |
+
st.image(im)
|
| 48 |
+
st.balloons()
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4f9f5777f8b4cef0c11d480e96ef09d07216e7239aaf964e3a92312d0ced843a
|
| 3 |
+
size 105265554
|