Spaces:
Runtime error
Runtime error
''' ---------------------------------------- | |
* Creation Time : Sun Aug 28 21:38:58 2022 | |
* Last Modified : Sun Aug 28 21:41:36 2022 | |
* Author : Charles N. Christensen | |
* Github : github.com/charlesnchr | |
----------------------------------------''' | |
from turtle import title | |
import gradio as gr | |
import numpy as np | |
from PIL import Image | |
import io | |
import base64 | |
from NNfunctions import * | |
opt = GetOptions_allRnd_0317() | |
net = LoadModel(opt) | |
def predict(image): | |
img = np.array(image) | |
img = np.concatenate((img,img,img),axis=2) | |
img = np.transpose(img, (2,0,1)) | |
# sr,wf,out = EvaluateModel(net,opt,img,outfile) | |
sr_img = EvaluateModel(net,opt,img) | |
return sr_img | |
title = '<h1 style="text-align: center;">ML-SIM: Reconstruction of SIM images with deep learning</h1>' | |
description = """ | |
## About | |
This space demonstrates the use of a semantic segmentation model to segment pets and classify them | |
according to the pixels. | |
## π To run | |
Upload a pet image and hit submit or select one from the given examples | |
""" | |
inputs = gr.inputs.Image(label="Upload a TIFF image", type = 'pil', optional=False) | |
outputs = [ | |
gr.outputs.Image(label="SIM Reconstruction") | |
# , gr.outputs.Textbox(type="auto",label="Pet Prediction") | |
] | |
examples = [ | |
"./examples/dogcat.jpeg", | |
] | |
interface = gr.Interface(fn=predict, | |
inputs=inputs, | |
outputs=outputs, | |
title = title, | |
description=description, | |
examples=examples | |
) | |
interface.launch() | |