Update core_creator/code_generator.py
Browse files- core_creator/code_generator.py +19 -19
core_creator/code_generator.py
CHANGED
@@ -7,25 +7,25 @@ client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
|
7 |
|
8 |
def generate_app_code(blueprint: dict) -> str:
|
9 |
base_prompt = f"""
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
response = client.chat.completions.create(
|
31 |
model="gpt-4o",
|
|
|
7 |
|
8 |
def generate_app_code(blueprint: dict) -> str:
|
9 |
base_prompt = f"""
|
10 |
+
You are an expert Python developer and Gradio engineer.
|
11 |
+
Generate a Hugging Face-ready app that does the following:
|
12 |
+
|
13 |
+
Title: {blueprint.get("title")}
|
14 |
+
Description: {blueprint.get("description")}
|
15 |
+
|
16 |
+
Inputs: {blueprint.get("inputs")}
|
17 |
+
Outputs: {blueprint.get("outputs")}
|
18 |
+
Voice Commands: {blueprint.get("voice_commands")}
|
19 |
+
|
20 |
+
Requirements:
|
21 |
+
- Use Gradio Blocks.
|
22 |
+
- Accept user voice or text input.
|
23 |
+
- Use placeholder code for hardware control (e.g., robot.move_arm()).
|
24 |
+
- Print logs for each user command detected.
|
25 |
+
- Keep it in a single Python file.
|
26 |
+
- Wrap robot behavior in a function named `robot_behavior()`.
|
27 |
+
- Return only the Python code, no extra explanation.
|
28 |
+
"""
|
29 |
|
30 |
response = client.chat.completions.create(
|
31 |
model="gpt-4o",
|