Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import gradio as gr
|
|
3 |
from huggingface_hub import InferenceClient
|
4 |
from e2b_code_interpreter import Sandbox
|
5 |
from pathlib import Path
|
|
|
6 |
|
7 |
from utils import run_interactive_notebook, create_base_notebook, update_notebook_display
|
8 |
|
@@ -32,6 +33,8 @@ List of available files:
|
|
32 |
|
33 |
def execute_jupyter_agent(sytem_prompt, user_input, max_new_tokens, model,files, message_history):
|
34 |
client = InferenceClient(api_key=HF_TOKEN)
|
|
|
|
|
35 |
#model = "meta-llama/Llama-3.1-8B-Instruct"
|
36 |
|
37 |
sbx = Sandbox(api_key=E2B_API_KEY)
|
@@ -54,7 +57,7 @@ def execute_jupyter_agent(sytem_prompt, user_input, max_new_tokens, model,files,
|
|
54 |
|
55 |
print("history:", message_history)
|
56 |
|
57 |
-
for notebook_html, messages in run_interactive_notebook(client, model, message_history, sbx, max_new_tokens=max_new_tokens):
|
58 |
message_history = messages
|
59 |
yield notebook_html, message_history
|
60 |
|
|
|
3 |
from huggingface_hub import InferenceClient
|
4 |
from e2b_code_interpreter import Sandbox
|
5 |
from pathlib import Path
|
6 |
+
from transformers import AutoTokenizer
|
7 |
|
8 |
from utils import run_interactive_notebook, create_base_notebook, update_notebook_display
|
9 |
|
|
|
33 |
|
34 |
def execute_jupyter_agent(sytem_prompt, user_input, max_new_tokens, model,files, message_history):
|
35 |
client = InferenceClient(api_key=HF_TOKEN)
|
36 |
+
|
37 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
38 |
#model = "meta-llama/Llama-3.1-8B-Instruct"
|
39 |
|
40 |
sbx = Sandbox(api_key=E2B_API_KEY)
|
|
|
57 |
|
58 |
print("history:", message_history)
|
59 |
|
60 |
+
for notebook_html, messages in run_interactive_notebook(client, model, tokenizer, message_history, sbx, max_new_tokens=max_new_tokens):
|
61 |
message_history = messages
|
62 |
yield notebook_html, message_history
|
63 |
|