Pasula commited on
Commit
c5dcc81
·
1 Parent(s): e58493f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+
4
+ def compilerx_text_generation(input_data:str):
5
+ """_summary_
6
+ Takes data set from source,feeds to EleutherAI/gpt-neo-2.7B model
7
+
8
+ Args:
9
+ input_data (str): compilerx-data
10
+
11
+ Returns:
12
+ json response (dict): response based on input data.
13
+ """
14
+ generator = pipeline('text-generation', model='EleutherAI/gpt-neo-2.7B')
15
+ response = generator(input_data, max_length=50, num_return_sequences=1)
16
+ print(response[0]['generated_text'])
17
+ return (
18
+ {
19
+ 'status': True,
20
+ 'response': response[0]['generated_text']
21
+ }
22
+ )
23
+
24
+ # Define your input data
25
+ input_data = "Millions of Companies At Your Fingertips A premium Compiled B2B database to tap into the right contacts with buying power! We help you work smarter."
26
+ response = compilerx_text_generation(input_data=input_data)
27
+ print(response)
28
+
29
+