Sangjun2 commited on
Commit
6abc133
·
verified ·
1 Parent(s): 84d4a09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -21,8 +21,6 @@ import logging
21
  import subprocess
22
  import spaces
23
 
24
- @spaces.GPU
25
-
26
  # Git LFS pull 명령어 실행
27
  result = subprocess.run(['git', 'lfs', 'pull'], capture_output=True, text=True)
28
 
@@ -78,6 +76,7 @@ def format_output(prediction):
78
  return prediction.replace('<0x0A>', '\n')
79
 
80
  # First model prediction ko-deplot
 
81
  def predict_model1(image):
82
  images = [image]
83
  inputs = processor1(images=images, text="What is the title of the chart", return_tensors="pt", padding=True)
@@ -110,6 +109,7 @@ def replace_unk(text):
110
  return text
111
 
112
  # Second model prediction aihub_deplot
 
113
  def predict_model2(image):
114
  image = image.convert("RGB")
115
  inputs = processor2(images=image, return_tensors="pt", max_patches=MAX_PATCHES).to(device)
@@ -126,6 +126,7 @@ def predict_model2(image):
126
  refined_table = replace_unk(generated_datatable)
127
  return refined_table
128
 
 
129
  def predict_model3(image):
130
  image=image.convert("RGB")
131
  input_prompt = "<extract_data_table> <s_answer>"
 
21
  import subprocess
22
  import spaces
23
 
 
 
24
  # Git LFS pull 명령어 실행
25
  result = subprocess.run(['git', 'lfs', 'pull'], capture_output=True, text=True)
26
 
 
76
  return prediction.replace('<0x0A>', '\n')
77
 
78
  # First model prediction ko-deplot
79
+ @spaces.GPU(enable_queue=True)
80
  def predict_model1(image):
81
  images = [image]
82
  inputs = processor1(images=images, text="What is the title of the chart", return_tensors="pt", padding=True)
 
109
  return text
110
 
111
  # Second model prediction aihub_deplot
112
+ @spaces.GPU(enable_queue=True)
113
  def predict_model2(image):
114
  image = image.convert("RGB")
115
  inputs = processor2(images=image, return_tensors="pt", max_patches=MAX_PATCHES).to(device)
 
126
  refined_table = replace_unk(generated_datatable)
127
  return refined_table
128
 
129
+ @spaces.GPU(enable_queue=True)
130
  def predict_model3(image):
131
  image=image.convert("RGB")
132
  input_prompt = "<extract_data_table> <s_answer>"