File size: 1,457 Bytes
ba9a83a
 
 
 
 
 
 
 
 
 
 
 
 
3715c63
ba9a83a
3715c63
 
ba9a83a
 
 
3715c63
 
ba9a83a
3715c63
 
ba9a83a
3715c63
ba9a83a
 
3715c63
ba9a83a
 
 
 
 
 
 
 
 
3715c63
ba9a83a
3715c63
ba9a83a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
''' ----------------------------------------
* 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()