Created
November 28, 2023 14:48
-
-
Save goddoe/1d87bc2d8dae6c3c2fbeb59b01c7ee87 to your computer and use it in GitHub Desktop.
extract_code.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extract_code(inputs: dict) -> dict: | |
text = inputs["text"] | |
result = re.search(r'```.*?\n(.*?)\n```', text, re.DOTALL) | |
result = result.group(1) if result else text | |
return {"output": result} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment