oberbics commited on
Commit
6248a95
·
verified ·
1 Parent(s): d2fedef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -145,7 +145,13 @@ def gradio_interface_function(template, text, size, is_example):
145
  return # End the function since there was an error
146
 
147
  # Initialize the sliding window prediction process
148
- prediction_generator = sliding_window_prediction(template, text, model, tokenizer, window_size=int(size))
 
 
 
 
 
 
149
 
150
  # Iterate over the generator to return values at each step
151
  for progress, full_pred, html_content in prediction_generator:
 
145
  return # End the function since there was an error
146
 
147
  # Initialize the sliding window prediction process
148
+ # Check if size is a boolean (from examples) and use a default if it is
149
+ if isinstance(size, bool) or size == 'True':
150
+ window_size = 4000 # Use default window size for examples
151
+ else:
152
+ window_size = int(size)
153
+
154
+ prediction_generator = sliding_window_prediction(template, text, model, tokenizer, window_size=window_size)
155
 
156
  # Iterate over the generator to return values at each step
157
  for progress, full_pred, html_content in prediction_generator: