Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
from PIL import Image, ImageDraw, ImageFont
|
2 |
from dotenv import load_dotenv
|
3 |
import matplotlib.pyplot as plt
|
|
|
4 |
import gradio as gr
|
5 |
import numpy as np
|
6 |
import requests
|
|
|
7 |
import boto3
|
8 |
import uuid
|
9 |
import os
|
@@ -154,7 +156,9 @@ def testing_yolocounter(input_img):
|
|
154 |
countings = response['countings_scinames']
|
155 |
coverage = response['coverage']
|
156 |
detections = response['detections']
|
157 |
-
|
|
|
|
|
158 |
return img, text
|
159 |
|
160 |
def testing_directcounter(input_img):
|
|
|
1 |
from PIL import Image, ImageDraw, ImageFont
|
2 |
from dotenv import load_dotenv
|
3 |
import matplotlib.pyplot as plt
|
4 |
+
from io import BytesIO
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
7 |
import requests
|
8 |
+
import base64
|
9 |
import boto3
|
10 |
import uuid
|
11 |
import os
|
|
|
156 |
countings = response['countings_scinames']
|
157 |
coverage = response['coverage']
|
158 |
detections = response['detections']
|
159 |
+
img_out = response['img_out']
|
160 |
+
img = Image.open(BytesIO(base64.b64decode(img_out)))
|
161 |
+
_, text = display_detectionsandcountings_yolocounter(input_img, detections, countings, coverage, prob_th=0, cth = 0)
|
162 |
return img, text
|
163 |
|
164 |
def testing_directcounter(input_img):
|