Spaces:
Sleeping
Sleeping
Download utils/generate_content.py from Samagra07/LinkedIn-Post-Generator: direct link, hf CLI and curl.
- Browser
- Download file 656 Bytes
-
https://huggingface.co/spaces/Samagra07/LinkedIn-Post-Generator/resolve/main/utils/generate_content.py
- Command line
-
hf download hf://spaces/Samagra07/LinkedIn-Post-Generator/utils/generate_content.py
-
curl -L -o generate_content.py https://huggingface.co/spaces/Samagra07/LinkedIn-Post-Generator/resolve/main/utils/generate_content.py
656 Bytes
| from loggers.logger import logger | |
| from template.response_prompt import GENERATE_CHAIN | |
| import sys | |
| sys.dont_write_bytecode = True | |
| def generate(state): | |
| """ | |
| Generate Answer | |
| Args: | |
| state (dict): The current graph state | |
| Return: | |
| state (dict): New key added to state | |
| """ | |
| logger.info("STEP: GENERATING FINAL RESPONSE") | |
| question = state['question'] | |
| try: | |
| context = state['context'] | |
| except: | |
| context = " " | |
| generation = GENERATE_CHAIN.invoke( | |
| { | |
| "context": context, | |
| "question": question | |
| } | |
| ) | |
| return { | |
| "generation": generation | |
| } |