bernardo-de-almeida Yanisadel commited on
Commit
c12d243
·
verified ·
1 Parent(s): e22db07

Update app.py (#19)

Browse files

- Update app.py (17707514a49a668d9212b39dc8c9d3efdaa26baf)


Co-authored-by: Yanis Adel <[email protected]>

Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -18,6 +18,10 @@ def log_message(message: str):
18
  # --- Utilities ---
19
  def read_dna_sequence(dna_text, fasta_file):
20
  """
 
 
 
 
21
  Returns:
22
  dna_sequence: str
23
  warning: str if any
@@ -62,11 +66,21 @@ def read_dna_sequence(dna_text, fasta_file):
62
  return dna_sequence, warning.strip(), error
63
 
64
 
65
- def validate_inputs(dna_sequence, custom_question):
66
  """
 
 
 
 
 
 
 
 
67
  Returns:
68
  valid: bool
 
69
  error: str
 
70
  """
71
  placeholders = custom_question.count("<DNA>")
72
 
@@ -198,6 +212,7 @@ You can either paste a sequence or upload a FASTA file.
198
 
199
  ### ❌ What will not work properly
200
  - "What is the length of this sequence `<DNA>`?"
 
201
 
202
  For more examples, you can refer to the [training dataset](https://huggingface.co/datasets/InstaDeepAI/ChatNT_training_data).
203
  """
 
18
  # --- Utilities ---
19
  def read_dna_sequence(dna_text, fasta_file):
20
  """
21
+ This function reads the DNA sequence, either from the text field or from the FASTA file,
22
+ and it checks the format.
23
+ It might return an error if the format of the FASTA file is incorrect.
24
+
25
  Returns:
26
  dna_sequence: str
27
  warning: str if any
 
66
  return dna_sequence, warning.strip(), error
67
 
68
 
69
+ def validate_inputs(dna_sequence: str, custom_question: str):
70
  """
71
+ This function is used to
72
+
73
+ Args:
74
+ dna_sequence (str): DNA sequence used by the user.
75
+ Note: It might be empty ("")
76
+
77
+ custom_question (str): Question of the user (in english).
78
+
79
  Returns:
80
  valid: bool
81
+ Whether the input is valid (correct number of <DNA> tokens, etc)
82
  error: str
83
+ Error message if necessary
84
  """
85
  placeholders = custom_question.count("<DNA>")
86
 
 
212
 
213
  ### ❌ What will not work properly
214
  - "What is the length of this sequence `<DNA>`?"
215
+ - "Replace the all 'A' nucleotides by 'G' in this sequence `<DNA>`.
216
 
217
  For more examples, you can refer to the [training dataset](https://huggingface.co/datasets/InstaDeepAI/ChatNT_training_data).
218
  """