ezamorag commited on
Commit
ec2e043
·
1 Parent(s): 1ca44dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -31,6 +31,13 @@ def upload2aws(img_array):
31
  s3.put_object(Bucket='predict-packages', Key=f'images_webapp_counters/{unique_name}.jpg', Body=buffer)
32
  return None
33
 
 
 
 
 
 
 
 
34
  def send2api(input_img, api_url):
35
  buf = io.BytesIO()
36
  plt.imsave(buf, input_img, format='jpg')
@@ -138,8 +145,8 @@ def testing_directcounter(input_img):
138
  return img, text
139
 
140
  def video_identity(video):
141
-
142
- return video, print(type(video), video)
143
 
144
  with gr.Blocks() as demo:
145
  gr.Markdown("Submit an image with insects in a trap")
 
31
  s3.put_object(Bucket='predict-packages', Key=f'images_webapp_counters/{unique_name}.jpg', Body=buffer)
32
  return None
33
 
34
+ def vidupload2aws(vid_path):
35
+ vid_name = os.path.basename(vid_path)
36
+ _, ext = os.path.splitext(vid_name)
37
+ unique_name = str(uuid.uuid4())
38
+ s3.upload_file(vid_path, 'predict-packages', f'images_webapp_counters/videos/{unique_name}{ext}')
39
+ return None
40
+
41
  def send2api(input_img, api_url):
42
  buf = io.BytesIO()
43
  plt.imsave(buf, input_img, format='jpg')
 
145
  return img, text
146
 
147
  def video_identity(video):
148
+ vidupload2aws(video)
149
+ return video
150
 
151
  with gr.Blocks() as demo:
152
  gr.Markdown("Submit an image with insects in a trap")