jayasuriyaK commited on
Commit
de23dde
·
verified ·
1 Parent(s): 2f3306c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,6 +1,7 @@
1
  #run the app
2
  #python -m streamlit run d:/NSFW/Project/test1.py
3
  import torch
 
4
  from transformers import BertTokenizer, BertForSequenceClassification
5
  import math, keras_ocr
6
  # Initialize pipeline
@@ -79,6 +80,7 @@ if uploaded_file is not None:
79
  # prediction_groups is a list of (word, box) tuples
80
  prediction_groups = pipeline.recognize([read_image])
81
  predictions = prediction_groups[0] # extract text list
 
82
  predictions = get_distance(predictions)
83
  # Set thresh higher for text further apart
84
  predictions = list(distinguish_rows(predictions, thresh=10))
 
1
  #run the app
2
  #python -m streamlit run d:/NSFW/Project/test1.py
3
  import torch
4
+ import tensorflow
5
  from transformers import BertTokenizer, BertForSequenceClassification
6
  import math, keras_ocr
7
  # Initialize pipeline
 
80
  # prediction_groups is a list of (word, box) tuples
81
  prediction_groups = pipeline.recognize([read_image])
82
  predictions = prediction_groups[0] # extract text list
83
+ tf.keras.backend.clear_session()
84
  predictions = get_distance(predictions)
85
  # Set thresh higher for text further apart
86
  predictions = list(distinguish_rows(predictions, thresh=10))