Spaces:
Build error
Build error
| """ | |
| Generate a prompt for generating the title of a paper based on its abstract. | |
| Args: | |
| usr_input (str): A string containing the title and abstract of the paper in the format "Title: <title> Abstract: <abstract>". | |
| template (dict): A dictionary containing the template for the prompt with a key "prompt_input". | |
| Returns: | |
| str: A formatted string with the instruction and abstract to be used as input for generating the title. | |
| """ | |
| def abs_2_title(usr_input, template, has_predefined_template=False): | |
| instruction = "Please generate the title of paper based on its abstract" | |
| if has_predefined_template: | |
| res = [ | |
| {"role": "system", "content": instruction}, | |
| {"role": "user", "content": usr_input}, | |
| ] | |
| else: | |
| res = template["prompt_input"].format(instruction=instruction, input=usr_input) | |
| return res | |