oanaflores commited on
Commit
3339cd8
·
1 Parent(s): 1fc59d5

Added application and requirements.txt file

Browse files
Files changed (2) hide show
  1. app.py +26 -0
  2. requirements.txt +44 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+
5
+ model_name = "bigscience/bloom-560m"
6
+ nlp_model = pipeline("text-generation", model=model_name, tokenizer=model_name)
7
+
8
+ def generate_text(input_text, max_length):
9
+ generated_text = nlp_model(input_text, max_length=max_length)
10
+ return f"<br>---<br>".join([sequence["generated_text"] for sequence in generated_text])
11
+
12
+
13
+ input_textbox = gr.inputs.Textbox(lines=5, placeholder="Enter your text here...")
14
+ max_length_slider = gr.inputs.Slider(minimum=10, maximum=200, default=50, step=1, label="Max Length")
15
+
16
+ output_html = gr.outputs.HTML()
17
+
18
+
19
+ gr.Interface(
20
+ fn=generate_text,
21
+ inputs=[input_textbox, max_length_slider],
22
+ outputs=output_html,
23
+ title="Bloom-560m Text Generation",
24
+ description="A demo for the bigscience/bloom-560m model.",
25
+ disable_cache=True,
26
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohttp==3.8.4
2
+ aiosignal==1.3.1
3
+ async-timeout==4.0.2
4
+ attrs==22.2.0
5
+ certifi==2022.9.24
6
+ cffi==1.15.1
7
+ charset-normalizer==2.1.1
8
+ click==8.1.3
9
+ cryptography==38.0.4
10
+ distlib==0.3.6
11
+ filelock==3.9.0
12
+ frozenlist==1.3.3
13
+ gigalixir==1.3.1
14
+ idna==3.4
15
+ joblib==1.2.0
16
+ multidict==6.0.4
17
+ numpy==1.23.5
18
+ openai==0.27.2
19
+ packaging==22.0
20
+ pipenv==2023.2.4
21
+ platformdirs==3.0.0
22
+ pycparser==2.21
23
+ pydantic==1.10.2
24
+ Pygments==2.13.0
25
+ pyOpenSSL==22.1.0
26
+ PyPDF2==3.0.1
27
+ pyreadline==2.1
28
+ qrcode==7.3.1
29
+ replicate==0.4.0
30
+ requests==2.28.1
31
+ rollbar==0.16.3
32
+ scikit-learn==1.1.3
33
+ scipy==1.9.3
34
+ six==1.16.0
35
+ sklearn==0.0.post1
36
+ stripe==5.0.0
37
+ threadpoolctl==3.1.0
38
+ tqdm==4.65.0
39
+ typing_extensions==4.4.0
40
+ urllib3==1.26.13
41
+ virtualenv==20.19.0
42
+ virtualenv-clone==0.5.7
43
+ yarl==1.8.2
44
+