Spaces:
Runtime error
Runtime error
SyedUmairHasan
commited on
Commit
•
ab689e9
1
Parent(s):
f0d807c
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from streamlit_drawable_canvas import st_canvas
|
|
3 |
import cv2
|
4 |
import requests
|
5 |
import time
|
|
|
6 |
|
7 |
st.title("Text Detection")
|
8 |
|
@@ -33,9 +34,9 @@ def signaturefunk():
|
|
33 |
if flag == True:
|
34 |
with open('img.jpg', 'rb') as f:
|
35 |
data = f.read()
|
36 |
-
r = requests.post(
|
37 |
time.sleep(3)
|
38 |
-
r2 = requests.get(r.headers['Operation-Location'],headers={"Ocp-Apim-Subscription-Key":
|
39 |
my_dict = {}
|
40 |
print(r2.json())
|
41 |
for line in r2.json()['analyzeResult']['readResults'][0]['lines']:
|
|
|
3 |
import cv2
|
4 |
import requests
|
5 |
import time
|
6 |
+
import os
|
7 |
|
8 |
st.title("Text Detection")
|
9 |
|
|
|
34 |
if flag == True:
|
35 |
with open('img.jpg', 'rb') as f:
|
36 |
data = f.read()
|
37 |
+
r = requests.post(os.environ["endpoint"],data=data,headers={"Ocp-Apim-Subscription-Key":os.environ["key"],"Content-Type": "application/octet-stream"})
|
38 |
time.sleep(3)
|
39 |
+
r2 = requests.get(r.headers['Operation-Location'],headers={"Ocp-Apim-Subscription-Key":os.environ["key"]})
|
40 |
my_dict = {}
|
41 |
print(r2.json())
|
42 |
for line in r2.json()['analyzeResult']['readResults'][0]['lines']:
|