Ziptoze commited on
Commit
5a150b9
·
verified ·
1 Parent(s): 4aadd8c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -199,11 +199,10 @@ def stream_ocr(image):
199
  inputs,
200
  streamer=streamer,
201
  max_new_tokens=2048,
202
- repetition_penalty=1.2,
203
- no_repeat_ngram_size=0,
204
- do_sample=True,
205
- temperature=0.2,
206
- top_p=0.95,
207
  use_cache=True
208
  )
209
 
@@ -236,8 +235,8 @@ example_images = []
236
  data_dir = os.path.join(os.path.dirname(__file__), 'data')
237
  if os.path.exists(data_dir):
238
  valid_exts = {".jpg", ".jpeg", ".png", ".bmp", ".webp"}
239
- # Gradio Examples expects a list of lists: [[path1], [path2], ...]
240
- example_images = [[os.path.join(data_dir, f)] for f in os.listdir(data_dir)
241
  if os.path.splitext(f)[1].lower() in valid_exts]
242
 
243
  # --- Aesthetic Custom CSS ---
 
199
  inputs,
200
  streamer=streamer,
201
  max_new_tokens=2048,
202
+ repetition_penalty=1.1, # Reduced from 1.2 to slightly speed up
203
+ do_sample=False, # GREEDY DECODING: Much faster than sampling on CPU
204
+ # temperature=0.2, # Not used in greedy
205
+ # top_p=0.95, # Not used in greedy
 
206
  use_cache=True
207
  )
208
 
 
235
  data_dir = os.path.join(os.path.dirname(__file__), 'data')
236
  if os.path.exists(data_dir):
237
  valid_exts = {".jpg", ".jpeg", ".png", ".bmp", ".webp"}
238
+ # Use Relative Paths for Gradio compatibility
239
+ example_images = [[os.path.join("data", f)] for f in os.listdir(data_dir)
240
  if os.path.splitext(f)[1].lower() in valid_exts]
241
 
242
  # --- Aesthetic Custom CSS ---