Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,24 @@ message_history = None
|
|
10 |
E2B_API_KEY = os.environ['E2B_API_KEY']
|
11 |
HF_TOKEN = os.environ['HF_TOKEN']
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
def execute_jupyter_agent(sytem_prompt, user_input):
|
15 |
client = InferenceClient(api_key=HF_TOKEN)
|
@@ -50,8 +68,8 @@ with gr.Blocks(css=css) as demo:
|
|
50 |
gr.Markdown("# HTML Generator")
|
51 |
|
52 |
with gr.Row():
|
53 |
-
system_input = gr.Textbox(label="System prompt", value=
|
54 |
-
user_input = gr.Textbox(label="User prompt", placeholder="
|
55 |
|
56 |
generate_btn = gr.Button("Let's go!")
|
57 |
output = gr.HTML(label="Jupyter Notebook")
|
|
|
10 |
E2B_API_KEY = os.environ['E2B_API_KEY']
|
11 |
HF_TOKEN = os.environ['HF_TOKEN']
|
12 |
|
13 |
+
DEFAULT_SYSTEM_PROMPT = """Environment: ipython
|
14 |
+
|
15 |
+
You are a code assistant with access to a ipython interpreter.
|
16 |
+
You solve tasks step-by-step and rely on code execution results.
|
17 |
+
Don't make any assumptions about the data but always check the format first.
|
18 |
+
If you generate code in your response you always run it in the interpreter.
|
19 |
+
When fix a mistake in the code always run it again.
|
20 |
+
|
21 |
+
Follow these steps given a new task and dataset:
|
22 |
+
1. Read in the data and make sure you understand each files format and content by printing useful information.
|
23 |
+
2. Execute the code at this point and don't try to write a solution before looking at the execution result.
|
24 |
+
3. After exploring the format write a quick action plan to solve the task from the user.
|
25 |
+
4. Then call the ipython interpreter directly with the solution and look at the execution result.
|
26 |
+
5. If there is an issue with the code, reason about potential issues and then propose a solution and execute again the fixed code and check the result.
|
27 |
+
Always run the code at each step and repeat the steps if necessary until you reach a solution.
|
28 |
+
|
29 |
+
NEVER ASSUME, ALWAYS VERIFY!"""
|
30 |
+
|
31 |
|
32 |
def execute_jupyter_agent(sytem_prompt, user_input):
|
33 |
client = InferenceClient(api_key=HF_TOKEN)
|
|
|
68 |
gr.Markdown("# HTML Generator")
|
69 |
|
70 |
with gr.Row():
|
71 |
+
system_input = gr.Textbox(label="System prompt", value=DEFAULT_SYSTEM_PROMPT)
|
72 |
+
user_input = gr.Textbox(label="User prompt", placeholder="Solve the Lotka-Volterra equation and plot the results.", lines=3)
|
73 |
|
74 |
generate_btn = gr.Button("Let's go!")
|
75 |
output = gr.HTML(label="Jupyter Notebook")
|