bernardo-de-almeida commited on
Commit
89c5f16
·
1 Parent(s): 377641b

fix requirements

Browse files
Files changed (2) hide show
  1. app.py +11 -1
  2. requirements.txt +1 -1
app.py CHANGED
@@ -562,7 +562,17 @@ def predict(
562
  else:
563
  if not seq or not seq.strip():
564
  raise gr.Error("seq is required when use_coords=False")
565
- inputs = {"seq": seq.strip(), "species": species}
 
 
 
 
 
 
 
 
 
 
566
 
567
  # Verify species is in inputs before calling pipeline
568
  if "species" not in inputs:
 
562
  else:
563
  if not seq or not seq.strip():
564
  raise gr.Error("seq is required when use_coords=False")
565
+ seq_stripped = seq.strip()
566
+ # Check sequence size: max 1MB (1,048,576 bytes)
567
+ # Each character is typically 1 byte, so check length
568
+ MAX_SEQUENCE_SIZE = 1_048_576 # 1MB in bytes
569
+ if len(seq_stripped) > MAX_SEQUENCE_SIZE:
570
+ raise gr.Error(
571
+ f"Sequence input is too large ({len(seq_stripped):,} characters). "
572
+ f"Maximum allowed size is {MAX_SEQUENCE_SIZE:,} characters (1MB). "
573
+ f"Please use a shorter sequence or use genomic coordinates instead."
574
+ )
575
+ inputs = {"seq": seq_stripped, "species": species}
576
 
577
  # Verify species is in inputs before calling pipeline
578
  if "species" not in inputs:
requirements.txt CHANGED
@@ -5,5 +5,5 @@ numpy==2.3.5
5
  plotly==6.5.0
6
  pyBigWig==0.3.24
7
  requests==2.32.5
8
- torch==2.9.1
9
  transformers==4.57.3
 
5
  plotly==6.5.0
6
  pyBigWig==0.3.24
7
  requests==2.32.5
8
+ torch
9
  transformers==4.57.3