Peter commited on
Commit
766eaec
1 Parent(s): f12c306

:art: organize imports and format

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -3,38 +3,36 @@ app.py - the main file for the app. This creates the flask app and handles the r
3
 
4
  """
5
 
6
- import torch
7
- from transformers import pipeline
8
- from cleantext import clean
9
- from pathlib import Path
10
- import warnings
11
- import time
12
  import argparse
13
  import logging
14
- import gradio as gr
15
- from gradio.inputs import Slider, Textbox
16
  import os
17
  import sys
 
 
18
  from os.path import dirname
 
 
 
19
  import nltk
 
 
 
 
 
20
  from converse import discussion
21
  from grammar_improve import (
 
22
  detect_propers,
 
23
  load_ns_checker,
24
  neuspell_correct,
25
  remove_repeated_words,
26
  remove_trailing_punctuation,
27
- build_symspell_obj,
28
  symspeller,
29
- fix_punct_spacing,
30
- )
31
-
32
- from utils import (
33
- cleantxt_wrap,
34
- corr,
35
  )
 
36
 
37
- nltk.download("stopwords") # TODO: find where this requirement originates from
38
 
39
  sys.path.append(dirname(dirname(os.path.abspath(__file__))))
40
  warnings.filterwarnings(action="ignore", message=".*gradient_checkpointing*")
@@ -197,9 +195,12 @@ if __name__ == "__main__":
197
  iface = gr.Interface(
198
  chat,
199
  inputs=[
200
- Textbox(default_text="Why is everyone here eating chocolate cake?", label="prompt_message", placeholder="Enter a question",
201
- lines=2,
202
- ),
 
 
 
203
  Slider(
204
  minimum=0.0, maximum=1.0, step=0.01, default=0.6, label="temperature"
205
  ),
@@ -219,7 +220,6 @@ if __name__ == "__main__":
219
  ["Are you single?", 0.6, 0.95, 138],
220
  ["Do you like people?", 0.7, 0.95, 25],
221
  ["You never took a short cut before?", 0.7, 0.95, 125],
222
-
223
  ],
224
  title=f"GPT Chatbot Demo: {default_model} Model",
225
  description=f"A Demo of a Chatbot trained for conversation with humans. Size XL= 1.5B parameters.\n\n"
 
3
 
4
  """
5
 
 
 
 
 
 
 
6
  import argparse
7
  import logging
 
 
8
  import os
9
  import sys
10
+ import time
11
+ import warnings
12
  from os.path import dirname
13
+ from pathlib import Path
14
+
15
+ import gradio as gr
16
  import nltk
17
+ import torch
18
+ from cleantext import clean
19
+ from gradio.inputs import Slider, Textbox
20
+ from transformers import pipeline
21
+
22
  from converse import discussion
23
  from grammar_improve import (
24
+ build_symspell_obj,
25
  detect_propers,
26
+ fix_punct_spacing,
27
  load_ns_checker,
28
  neuspell_correct,
29
  remove_repeated_words,
30
  remove_trailing_punctuation,
 
31
  symspeller,
 
 
 
 
 
 
32
  )
33
+ from utils import corr
34
 
35
+ nltk.download("stopwords") # download stopwords
36
 
37
  sys.path.append(dirname(dirname(os.path.abspath(__file__))))
38
  warnings.filterwarnings(action="ignore", message=".*gradient_checkpointing*")
 
195
  iface = gr.Interface(
196
  chat,
197
  inputs=[
198
+ Textbox(
199
+ default="Why is everyone here eating chocolate cake?",
200
+ label="prompt_message",
201
+ placeholder="Enter a question",
202
+ lines=2,
203
+ ),
204
  Slider(
205
  minimum=0.0, maximum=1.0, step=0.01, default=0.6, label="temperature"
206
  ),
 
220
  ["Are you single?", 0.6, 0.95, 138],
221
  ["Do you like people?", 0.7, 0.95, 25],
222
  ["You never took a short cut before?", 0.7, 0.95, 125],
 
223
  ],
224
  title=f"GPT Chatbot Demo: {default_model} Model",
225
  description=f"A Demo of a Chatbot trained for conversation with humans. Size XL= 1.5B parameters.\n\n"