bhadresh-savani commited on
Commit
05942ee
1 Parent(s): ea29188

added model files

Browse files
Files changed (2) hide show
  1. app.py +40 -0
  2. requirements.txt +103 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import AutoTokenizer,AutoModelForSeq2SeqLM
3
+
4
+ @st.cache(persist=True)
5
+ def load_model(input_complex_sentence,model):
6
+
7
+ base_path = "flax-community/"
8
+ model_path = base_path + model
9
+ print(model_path)
10
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
11
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
12
+
13
+ tokenized_sentence = tokenizer(input_complex_sentence,return_tensors="pt")
14
+ result = model.generate(tokenized_sentence['input_ids'],attention_mask = tokenized_sentence['attention_mask'],max_length=256,num_beams=5)
15
+ print(result)
16
+ generated_sentence = tokenizer.decode(result[0],skip_special_tokens=True)
17
+
18
+ return generated_sentence
19
+
20
+ def main():
21
+
22
+ st.title("Sentence Split in English using T5 variants")
23
+ st.write("Sentence Split is the task of dividing a long Sentence into multiple Sentences")
24
+
25
+ model = st.sidebar.selectbox(
26
+ "Please Choose the Model",
27
+ ("t5-base-wikisplit","t5-v1_1-base-wikisplit", "byt5-base-wikisplit","t5-large-wikisplit"))
28
+ st.write("Model Selected : ", model)
29
+
30
+ example = "Mary likes to play football in her freetime whenever she meets with her friends that are very nice people."
31
+ input_complex_sentence = st.text_area("Please type a long Sentence to split",example)
32
+
33
+ if st.button('Simplify'):
34
+
35
+ generated_sentence = load_model(input_complex_sentence, model)
36
+ st.write(generated_sentence)
37
+
38
+
39
+ if __name__ == "__main__":
40
+ main()
requirements.txt ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==4.1.0
2
+ argon2-cffi==20.1.0
3
+ astor==0.8.1
4
+ async-generator==1.10
5
+ attrs==21.2.0
6
+ backcall==0.2.0
7
+ base58==2.1.0
8
+ bleach==3.3.0
9
+ blinker==1.4
10
+ cachetools==4.2.2
11
+ certifi==2021.5.30
12
+ cffi==1.14.5
13
+ chardet==4.0.0
14
+ click==7.1.2
15
+ datasets==1.9.0
16
+ debugpy==1.3.0
17
+ decorator==5.0.9
18
+ defusedxml==0.7.1
19
+ dill==0.3.4
20
+ entrypoints==0.3
21
+ filelock==3.0.12
22
+ fsspec==2021.6.1
23
+ gitdb==4.0.7
24
+ GitPython==3.1.18
25
+ huggingface-hub==0.0.12
26
+ idna==2.10
27
+ importlib-metadata==3.10.1
28
+ ipykernel==6.0.1
29
+ ipython==7.25.0
30
+ ipython-genutils==0.2.0
31
+ ipywidgets==7.6.3
32
+ jedi==0.18.0
33
+ Jinja2==3.0.1
34
+ joblib==1.0.1
35
+ jsonschema==3.2.0
36
+ jupyter-client==6.1.12
37
+ jupyter-core==4.7.1
38
+ jupyterlab-pygments==0.1.2
39
+ jupyterlab-widgets==1.0.0
40
+ MarkupSafe==2.0.1
41
+ matplotlib-inline==0.1.2
42
+ mistune==0.8.4
43
+ mkl-fft==1.3.0
44
+ mkl-random==1.1.1
45
+ mkl-service==2.3.0
46
+ multiprocess==0.70.12.2
47
+ nbclient==0.5.3
48
+ nbconvert==6.1.0
49
+ nbformat==5.1.3
50
+ nest-asyncio==1.5.1
51
+ notebook==6.4.0
52
+ numpy==1.21.0
53
+ olefile==0.46
54
+ packaging==21.0
55
+ pandas==1.3.0
56
+ pandocfilters==1.4.3
57
+ parso==0.8.2
58
+ pexpect==4.8.0
59
+ pickleshare==0.7.5
60
+ Pillow @ file:///tmp/build/80754af9/pillow_1625655818400/work
61
+ prometheus-client==0.11.0
62
+ prompt-toolkit==3.0.19
63
+ protobuf==3.17.3
64
+ ptyprocess==0.7.0
65
+ pyarrow==4.0.1
66
+ pycparser==2.20
67
+ pydeck==0.6.2
68
+ Pygments==2.9.0
69
+ pyparsing==2.4.7
70
+ pyrsistent==0.18.0
71
+ python-dateutil==2.8.1
72
+ pytz==2021.1
73
+ PyYAML==5.4.1
74
+ pyzmq==22.1.0
75
+ regex==2021.7.6
76
+ requests==2.25.1
77
+ sacremoses==0.0.45
78
+ Send2Trash==1.7.1
79
+ six @ file:///tmp/build/80754af9/six_1623709665295/work
80
+ smmap==4.0.0
81
+ streamlit==0.84.0
82
+ terminado==0.10.1
83
+ testpath==0.5.0
84
+ tokenizers==0.10.3
85
+ toml==0.10.2
86
+ toolz==0.11.1
87
+ torch==1.9.0
88
+ torchaudio==0.9.0a0+33b2469
89
+ torchvision==0.10.0
90
+ tornado==6.1
91
+ tqdm==4.61.2
92
+ traitlets==5.0.5
93
+ transformers==4.8.2
94
+ typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1624965014186/work
95
+ tzlocal==2.1
96
+ urllib3==1.26.6
97
+ validators==0.18.2
98
+ watchdog==2.1.3
99
+ wcwidth==0.2.5
100
+ webencodings==0.5.1
101
+ widgetsnbextension==3.5.1
102
+ xxhash==2.0.2
103
+ zipp==3.5.0