BeardedMonster commited on
Commit
873769e
·
verified ·
1 Parent(s): f21167e
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -18,12 +18,12 @@ model = AutoModelForCausalLM.from_pretrained(repo_name, trust_remote_code=True).
18
  st.sidebar.title("Instructions: How to use")
19
  st.sidebar.write("""
20
  1. Write something in the text area (a prompt or random text) or use the dropdown menu to select predefined sample text.
21
- 2. Select a task from the **task dropdown menu** below if you are providing your own text. **This is very important as it ensures the model responds accordingly.**
22
  3. If you are providing your own text, please do not select any predefined sample text from the dropdown menu.
23
  3. If a dropdown menu pops up for a nigerian language, **select the nigerian language (base language for diacritization and text cleaning tasks, target language for translation task).**
24
- 4. Click the Generate button to get a response below the text area.\n
25
  5. For Translation tasks, setting english as the target language yields the best result (english as base language performs the worst).
26
- **Note: Model's overall performance vary (hallucinates) due to model size and training data distribution (majorly from news articles and the bible). Performance may worsen significantly with other task outside text generation.
27
  For other tasks, we suggest you try them several times due to the generator's sampling method.**\n
28
  6. Lastly, you can play with some of the generation parameters below to improve performance.
29
  """)
@@ -199,7 +199,7 @@ else:
199
  task_value = task_options[task]
200
 
201
  def wrap_text(text, task_value):
202
- tasks = ["<classify>", "<prompt>", "<clean>", "<title>", "<diacritize>"]
203
  if any(task in text for task in tasks):
204
  return text
205
  return task_value.format(text)
@@ -209,6 +209,7 @@ def wrap_text(text, task_value):
209
  user_input = st.text_area("Enter text below **(PLEASE, FIRST READ ALL INSTRUCTIONS IN THE SIDEBAR CAREFULLY FOR THE BEST EXPERIENCE)**: ", sample_texts[sample_text])
210
  user_input = instruction_wrap.get(sample_texts.get(user_input, user_input), user_input)
211
  print("Final user input: ", user_input)
 
212
  if st.button("Generate"):
213
  if user_input:
214
  try:
 
18
  st.sidebar.title("Instructions: How to use")
19
  st.sidebar.write("""
20
  1. Write something in the text area (a prompt or random text) or use the dropdown menu to select predefined sample text.
21
+ 2. Select a task from the **task dropdown menu** below only if you are providing your own text. **This is very important as it ensures the model responds accordingly.**
22
  3. If you are providing your own text, please do not select any predefined sample text from the dropdown menu.
23
  3. If a dropdown menu pops up for a nigerian language, **select the nigerian language (base language for diacritization and text cleaning tasks, target language for translation task).**
24
+ 4. Then, click the Generate button.\n
25
  5. For Translation tasks, setting english as the target language yields the best result (english as base language performs the worst).
26
+ **Note: Model's overall performance vary (hallucinates) due to model size and training data distribution (majorly from articles and the bible). Performance may worsen with other task outside text generation and translation.
27
  For other tasks, we suggest you try them several times due to the generator's sampling method.**\n
28
  6. Lastly, you can play with some of the generation parameters below to improve performance.
29
  """)
 
199
  task_value = task_options[task]
200
 
201
  def wrap_text(text, task_value):
202
+ tasks = ["<classify>", "<prompt>", "<clean>", "<title>", "<diacritize>", "<translate>"]
203
  if any(task in text for task in tasks):
204
  return text
205
  return task_value.format(text)
 
209
  user_input = st.text_area("Enter text below **(PLEASE, FIRST READ ALL INSTRUCTIONS IN THE SIDEBAR CAREFULLY FOR THE BEST EXPERIENCE)**: ", sample_texts[sample_text])
210
  user_input = instruction_wrap.get(sample_texts.get(user_input, user_input), user_input)
211
  print("Final user input: ", user_input)
212
+
213
  if st.button("Generate"):
214
  if user_input:
215
  try: