forked from jackliu333/object_detection_using_tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.R
60 lines (49 loc) · 1.43 KB
/
server.R
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
server <- function(input, output) {
image_path <- reactive({
input$input_image_upload$datapath
})
prediction <- reactive({
req(image_path(), input$min_score_threshold)
if(is.null(image_path())){return(NULL)}
pred = predict_class(img_path=image_path(),
min_score_thresh=input$min_score_threshold)
# print(pred)
pred = convert_scoring_rst(pred)
pred
})
output$text <- renderTable({
req(image_path(), input$min_score_threshold)
prediction()
})
# Show uploaded image
output$output_image <- renderImage({
req(image_path())
outfile <- image_path()
contentType <- "image/jpeg"
list(src = outfile,
contentType=contentType,
width = 400)
}, deleteFile = FALSE)
# Show selected image
output$output_image_selected <- renderImage({
req(input$input_image_select)
outfile <- paste0('images/',input$input_image_select)
print(outfile)
contentType <- "image/jpeg"
list(src = outfile,
contentType=contentType,
width = 400)
}, deleteFile = FALSE)
output$output_image2 <- renderImage({
req(image_path(), input$min_score_threshold)
outfile <- "tmp_output/img.jpg"
contentType <- "jpg"
list(src = outfile,
contentType=contentType,
width = 400)
}, deleteFile = FALSE)
# show all product categories
output$all_cats <- renderText({
ALL_CATS
})
}