Hello! I am trying to deploy an image classification app on Streamlit and I decided to use learner.load(path) where the path is from a google colab repo which I have downloaded the path into my computer. However, when I try to run the webapp via Visual Studio Code, it is taking over an hour to run and yet it is still running… Is this like normal or is there something wrong with my code? I would be very thankful if you guys could give me some advice on this. Thanks in advance, my code is shown below.
import streamlit as st
import pandas as pd
import numpy as np
st.title('Steak Doneness Classifier')
add_selectbox = st.sidebar.write(
'Steak Doneness Classifier'
)
add_selectbox = st.sidebar.image(
'https://i.pinimg.com/originals/41/4e/57/414e57ac74d11b5bba0632f16a560589.jpg',
use_column_width=True
)
add_selectbox = st.sidebar.write(
'This web appliaction can predict the doneness of a steak via image input. The doneness of steak ranges from rare to well done!'
)
add_selectbox = st.sidebar.write(
'Links [link]()',
)
add_selectbox = st.sidebar.write(
'Google Collab [link]()',
)
add_selectbox = st.sidebar.write(
'Github [link](https://github.com/TheTrapperXD/steakdonenessclassifier)',
)
add_selectbox = st.sidebar.write(
'Kaggle Dataset [link](https://www.kaggle.com/datasets/pattanunw/steak-doneness-alternate)',
)
add_selectbox = st.sidebar.write(
'Reddit [link](https://www.reddit.com/user/TheTrapperBeingXD)',
)
import pandas as pd
from PIL import Image
from enum import Enum
from io import BytesIO, StringIO
from typing import Union
STYLE = """
<style>
img {
max-width: 100%;
}
</style>
"""
class FileUpload(object):
def __init__(self):
self.fileTypes = ["png", "jpg"]
def run(self):
"""
Upload File on Streamlit Code
:return:
"""
st.info(__doc__)
st.markdown(STYLE, unsafe_allow_html=True)
file = st.file_uploader("Upload file", type=self.fileTypes)
show_file = st.empty()
if not file:
show_file.info("Please upload a file of type: " + ", ".join(["png", "jpg"]))
return
content = file.getvalue()
if isinstance(file, BytesIO):
show_file.image(file)
else:
data = pd.read_csv(file)
st.dataframe(data.head(10))
file.close()
if __name__ == "__main__":
helper = FileUpload()
helper.run()
from fastbook import *
from fastai.vision import *
dls = fields.dataloaders('local')
learner = vision_learner(dls, resnet152, metrics=[error_rate, accuracy])
learner.load('C:/Users/satan/OneDrive/CPP/AI Builders - 1/steak_doneness_classifier.pth')