|
|
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'] |
|
|
} |
|
|
) |
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
|
|