Spaces:
Sleeping
Sleeping
Update utils.py
Browse filesComment out "import easyocr"; Comment out "ocr_reader" function. (Can be deleted)
utils.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
#utils.py
|
| 3 |
import openai
|
| 4 |
import os
|
| 5 |
-
import easyocr
|
| 6 |
import pandas as pd
|
| 7 |
import plotly.graph_objects as go
|
| 8 |
import plotly.express as px
|
|
@@ -11,18 +11,18 @@ from nltk.sentiment.vader import SentimentIntensityAnalyzer
|
|
| 11 |
import nltk
|
| 12 |
nltk.download('vader_lexicon')
|
| 13 |
|
| 14 |
-
def ocr_reader(lan, png):
|
| 15 |
-
locs = []; words = []; confidence = []
|
| 16 |
-
try:
|
| 17 |
-
reader = easyocr.Reader([str(lan)]) #Initialise Language
|
| 18 |
-
result = reader.readtext(str(png))
|
| 19 |
-
for i in result:
|
| 20 |
-
locs.append(i[0])
|
| 21 |
-
words.append(i[1])
|
| 22 |
-
confidence.append(i[2])
|
| 23 |
-
return locs, words, confidence
|
| 24 |
-
except Exception as e:
|
| 25 |
-
print(e)
|
| 26 |
|
| 27 |
def get_completion(prompt, model="gpt-3.5-turbo"):
|
| 28 |
messages = [{"role": "user", "content": prompt}]
|
|
|
|
| 2 |
#utils.py
|
| 3 |
import openai
|
| 4 |
import os
|
| 5 |
+
#import easyocr
|
| 6 |
import pandas as pd
|
| 7 |
import plotly.graph_objects as go
|
| 8 |
import plotly.express as px
|
|
|
|
| 11 |
import nltk
|
| 12 |
nltk.download('vader_lexicon')
|
| 13 |
|
| 14 |
+
#def ocr_reader(lan, png):
|
| 15 |
+
# locs = []; words = []; confidence = []
|
| 16 |
+
# try:
|
| 17 |
+
# reader = easyocr.Reader([str(lan)]) #Initialise Language
|
| 18 |
+
# result = reader.readtext(str(png))
|
| 19 |
+
# for i in result:
|
| 20 |
+
# locs.append(i[0])
|
| 21 |
+
# words.append(i[1])
|
| 22 |
+
# confidence.append(i[2])
|
| 23 |
+
# return locs, words, confidence
|
| 24 |
+
# except Exception as e:
|
| 25 |
+
# print(e)
|
| 26 |
|
| 27 |
def get_completion(prompt, model="gpt-3.5-turbo"):
|
| 28 |
messages = [{"role": "user", "content": prompt}]
|