m-ric HF staff commited on
Commit
3bc2f13
Β·
verified Β·
1 Parent(s): 300acbd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -1,23 +1,23 @@
1
  import os
2
  import shutil
3
  import gradio as gr
4
- from transformers import ReactCodeAgent, HfApiEngine, Tool
5
  import pandas as pd
6
 
7
  from gradio import Chatbot
8
- from transformers.agents 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 = HfApiEngine("meta-llama/Meta-Llama-3.1-70B-Instruct")
15
 
16
- agent = ReactCodeAgent(
17
  tools=[],
18
- llm_engine=llm_engine,
19
  additional_authorized_imports=["numpy", "pandas", "matplotlib.pyplot", "seaborn", "scipy.stats"],
20
- max_iterations=10,
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("""# Llama-3.1 Data analyst πŸ“ŠπŸ€”
109
 
110
- Drop a `.csv` file below, add notes to describe this data if needed, and **Llama-3.1-70B 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,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://em-content.zobj.net/source/twitter/53/robot-face_1f916.png",
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(