Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
import os
|
2 |
import shutil
|
3 |
import gradio as gr
|
4 |
-
from
|
5 |
import pandas as pd
|
6 |
|
7 |
from gradio import Chatbot
|
8 |
-
from
|
9 |
from huggingface_hub import login
|
10 |
from gradio.data_classes import FileData
|
11 |
|
12 |
login(os.getenv("HUGGINGFACEHUB_API_TOKEN"))
|
13 |
|
14 |
-
llm_engine =
|
15 |
|
16 |
-
agent =
|
17 |
tools=[],
|
18 |
-
|
19 |
additional_authorized_imports=["numpy", "pandas", "matplotlib.pyplot", "seaborn", "scipy.stats"],
|
20 |
-
|
21 |
)
|
22 |
|
23 |
base_prompt = """You are an expert data analyst.
|
@@ -105,9 +105,9 @@ with gr.Blocks(
|
|
105 |
secondary_hue=gr.themes.colors.blue,
|
106 |
)
|
107 |
) as demo:
|
108 |
-
gr.Markdown("""#
|
109 |
|
110 |
-
Drop a `.csv` file below, add notes to describe this data if needed, and
|
111 |
file_input = gr.File(label="Your file to analyze")
|
112 |
text_input = gr.Textbox(
|
113 |
label="Additional notes to support the analysis"
|
@@ -118,7 +118,7 @@ Drop a `.csv` file below, add notes to describe this data if needed, and **Llama
|
|
118 |
type="messages",
|
119 |
avatar_images=(
|
120 |
None,
|
121 |
-
"https://
|
122 |
),
|
123 |
)
|
124 |
gr.Examples(
|
|
|
1 |
import os
|
2 |
import shutil
|
3 |
import gradio as gr
|
4 |
+
from smolagents import CodeAgent, HfApiModel, Tool
|
5 |
import pandas as pd
|
6 |
|
7 |
from gradio import Chatbot
|
8 |
+
from smolagents import stream_to_gradio
|
9 |
from huggingface_hub import login
|
10 |
from gradio.data_classes import FileData
|
11 |
|
12 |
login(os.getenv("HUGGINGFACEHUB_API_TOKEN"))
|
13 |
|
14 |
+
llm_engine = HfApiModel("Qwen/Qwen2.5-Coder-32B-Instruct")
|
15 |
|
16 |
+
agent = CodeAgent(
|
17 |
tools=[],
|
18 |
+
model=model,
|
19 |
additional_authorized_imports=["numpy", "pandas", "matplotlib.pyplot", "seaborn", "scipy.stats"],
|
20 |
+
max_steps=10,
|
21 |
)
|
22 |
|
23 |
base_prompt = """You are an expert data analyst.
|
|
|
105 |
secondary_hue=gr.themes.colors.blue,
|
106 |
)
|
107 |
) as demo:
|
108 |
+
gr.Markdown("""# Qwen-2.5-Coder Data analyst ππ€
|
109 |
|
110 |
+
Drop a `.csv` file below, add notes to describe this data if needed, and **`Qwen2.5-Coder-32B-Instruct` will analyze the file content and draw figures for you!**""")
|
111 |
file_input = gr.File(label="Your file to analyze")
|
112 |
text_input = gr.Textbox(
|
113 |
label="Additional notes to support the analysis"
|
|
|
118 |
type="messages",
|
119 |
avatar_images=(
|
120 |
None,
|
121 |
+
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/mascot.png",
|
122 |
),
|
123 |
)
|
124 |
gr.Examples(
|