Ayushnangia commited on
Commit
038a94a
1 Parent(s): 40e9659

trying ZERO GPU

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -1,4 +1,6 @@
1
  import os
 
 
2
  import nltk
3
  nltk.download('punkt')
4
  from doctr.io import DocumentFile
@@ -56,7 +58,7 @@ def process_text_in_chunks(text, process_function, max_chunk_size=256):
56
  processed_text += " " # Add space after each processed sentence
57
 
58
  return processed_text.strip()
59
-
60
  def greet(img, apply_grammar_correction, apply_spell_check):
61
  img.save("out.jpg")
62
  doc = DocumentFile.from_images("out.jpg")
@@ -115,6 +117,7 @@ def split_text_into_batches(text, max_tokens_per_batch):
115
  batches.append(current_batch.strip()) # Add the last batch
116
  return batches
117
 
 
118
  def run_t2tt(file_uploader , input_text: str, source_language: str, target_language: str) -> (str, bytes):
119
  if file_uploader is not None:
120
  with open(file_uploader, 'r') as file:
 
1
  import os
2
+ import spaces
3
+
4
  import nltk
5
  nltk.download('punkt')
6
  from doctr.io import DocumentFile
 
58
  processed_text += " " # Add space after each processed sentence
59
 
60
  return processed_text.strip()
61
+ @spaces.GPU(duration=120)
62
  def greet(img, apply_grammar_correction, apply_spell_check):
63
  img.save("out.jpg")
64
  doc = DocumentFile.from_images("out.jpg")
 
117
  batches.append(current_batch.strip()) # Add the last batch
118
  return batches
119
 
120
+ @spaces.GPU(duration=120)
121
  def run_t2tt(file_uploader , input_text: str, source_language: str, target_language: str) -> (str, bytes):
122
  if file_uploader is not None:
123
  with open(file_uploader, 'r') as file: