Spaces:
Running
Running
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -1,6 +1,12 @@
|
|
| 1 |
import openai
|
|
|
|
| 2 |
from pathlib import Path
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# --- Lesson generation ---
|
| 6 |
def generate_lesson(topic):
|
|
@@ -42,4 +48,3 @@ def generate_image_via_agent(lesson_text):
|
|
| 42 |
output_path.parent.mkdir(exist_ok=True)
|
| 43 |
image.save(output_path)
|
| 44 |
return str(output_path)
|
| 45 |
-
|
|
|
|
| 1 |
import openai
|
| 2 |
+
import sys
|
| 3 |
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
# --- Ensure first_agent_template folder is importable ---
|
| 6 |
+
sys.path.append(str(Path(__file__).parent / "first_agent_template"))
|
| 7 |
+
|
| 8 |
+
# Now import the image-generation function
|
| 9 |
+
from generate import generate_image_from_text # Local agent function
|
| 10 |
|
| 11 |
# --- Lesson generation ---
|
| 12 |
def generate_lesson(topic):
|
|
|
|
| 48 |
output_path.parent.mkdir(exist_ok=True)
|
| 49 |
image.save(output_path)
|
| 50 |
return str(output_path)
|
|
|