Update app.py
Browse files
app.py
CHANGED
@@ -77,11 +77,11 @@ def index():
|
|
77 |
]
|
78 |
)
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
if not
|
83 |
raise Exception("No python code block found in the AI response.")
|
84 |
-
code =
|
85 |
|
86 |
|
87 |
scene_match = re.search(r"class\s+(\w+)\(.*Scene.*\):", code)
|
|
|
77 |
]
|
78 |
)
|
79 |
|
80 |
+
pattern = r"```python\s*(.*?)\s*```"
|
81 |
+
match = re.search(pattern, completion.choices[0].message.content, re.DOTALL)
|
82 |
+
if not match:
|
83 |
raise Exception("No python code block found in the AI response.")
|
84 |
+
code = match.group(1)
|
85 |
|
86 |
|
87 |
scene_match = re.search(r"class\s+(\w+)\(.*Scene.*\):", code)
|