sundea commited on
Commit
cd6c5f2
1 Parent(s): 160c701

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -35
app.py CHANGED
@@ -1,38 +1,4 @@
1
- import argparse
2
-
3
- import numpy as np
4
- import torch
5
- import gradio
6
-
7
- import gradio as gr
8
-
9
- def object_detection(image):
10
- image = image.convert("RGB")
11
- image = image.resize((640, 640))
12
- image = np.array(image).transpose((2, 0, 1))
13
- image = np.expand_dims(image, axis=0).astype(np.float32)
14
-
15
- # Run the model
16
- outputs = session.run([output_name], {input_name: image})
17
-
18
- # Postprocess the prediction
19
- prediction = outputs[0][0]
20
-
21
- return prediction
22
-
23
-
24
-
25
-
26
- with gr.Blocks() as demo:
27
- with gr.Row():
28
- image_input=gr.Image()
29
- image_output=gr.Image()
30
- image_text =gr.Text()
31
- image_button=gr.Button('start')
32
-
33
- image_button.click(object_detection,inputs=image_input,outputs=[image_output,image_text])
34
- demo.close()
35
- demo.launch(server_port=9090)import os
36
  import sys
37
  import argparse
38
  import time
 
1
+ import os
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  import sys
3
  import argparse
4
  import time