|
|
|
from io import StringIO |
|
from PIL import Image |
|
import pandas as pd |
|
import numpy as np |
|
import glob |
|
import os |
|
|
|
import torch |
|
import torch.nn as nn |
|
from torch.utils.data import Dataset, DataLoader |
|
|
|
|
|
|
|
|
|
|
|
|
|
from tqdm import tqdm |
|
import cv2 |
|
|
|
import matplotlib.pyplot as plt |
|
import seaborn as sns |
|
|
|
|
|
model = models.resnet50(pretrained=False) |
|
model.fc = nn.Linear(2048, num_classes) |
|
model.load_state_dict(torch.load('resnet_best.pth'), strict=True) |
|
|
|
st.title("some big ML function") |
|
|
|
uploaded_file = st.file_uploader("Choose a file") |
|
|
|
if uploaded_file is not None: |
|
if ".jpg" in uploaded_file.name or ".png" in uploaded_file.name: |
|
image = Image.open(uploaded_file) |
|
st.image(image) |
|
|
|
elif ".csv" in uploaded_file.name: |
|
dataframe = pd.read_csv(uploaded_file) |
|
st.write(dataframe) |
|
|
|
|