Spaces:
Sleeping
Sleeping
Update code_extraction.py
Browse files- code_extraction.py +11 -0
code_extraction.py
CHANGED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
|
3 |
+
|
4 |
+
Class Extraction():
|
5 |
+
|
6 |
+
def extract_code(llm_output):
|
7 |
+
|
8 |
+
code_match = re.search(r"```python\n(.*?)\n```", llm_output, re.DOTALL)
|
9 |
+
if code_match:
|
10 |
+
return code_match.group(1)
|
11 |
+
return None
|