File size: 892 Bytes
c5dcc81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from transformers import pipeline


def compilerx_text_generation(input_data:str): 
    """_summary_
       Takes data set from source,feeds to EleutherAI/gpt-neo-2.7B model 

    Args:
        input_data (str): compilerx-data

    Returns:
        json response (dict): response based on input data.
    """
    generator = pipeline('text-generation', model='EleutherAI/gpt-neo-2.7B')
    response = generator(input_data, max_length=50, num_return_sequences=1)
    print(response[0]['generated_text'])
    return (
        {
            'status': True,
            'response': response[0]['generated_text']
        }
    )

# Define your input data
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."
response = compilerx_text_generation(input_data=input_data)
print(response)