Spaces:
Runtime error
Runtime error
ai-puppy
commited on
Commit
Β·
3f04a52
1
Parent(s):
bb43287
save
Browse files
README.md
CHANGED
@@ -9,6 +9,7 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
short_description: CodeAct Agent to process large data set
|
|
|
12 |
---
|
13 |
|
14 |
An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
|
|
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
short_description: CodeAct Agent to process large data set
|
12 |
+
tags: agent-demo-track
|
13 |
---
|
14 |
|
15 |
An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
|
app.py
CHANGED
@@ -62,8 +62,6 @@ codeact_model = init_chat_model("gpt-4.1-2025-04-14", model_provider="openai")
|
|
62 |
# Store uploaded file path globally
|
63 |
uploaded_file_path = None
|
64 |
|
65 |
-
# Chat functionality removed - focusing on file analysis
|
66 |
-
|
67 |
def handle_file_upload(file):
|
68 |
"""Handle file upload and store the path globally"""
|
69 |
global uploaded_file_path
|
@@ -167,16 +165,30 @@ def run_file_analysis():
|
|
167 |
return asyncio.run(analyze_uploaded_file())
|
168 |
|
169 |
# Create the Gradio interface
|
170 |
-
with gr.Blocks(title="DataForge - AI
|
171 |
-
gr.Markdown("#
|
172 |
gr.Markdown("""
|
173 |
-
|
|
|
|
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
""")
|
181 |
|
182 |
with gr.Row():
|
@@ -193,6 +205,7 @@ with gr.Blocks(title="DataForge - AI-Powered File Analysis") as demo:
|
|
193 |
interactive=False
|
194 |
)
|
195 |
|
|
|
196 |
# Question Section
|
197 |
gr.Markdown("### β Ask Your Question")
|
198 |
user_question = gr.Textbox(
|
@@ -202,25 +215,25 @@ with gr.Blocks(title="DataForge - AI-Powered File Analysis") as demo:
|
|
202 |
value=""
|
203 |
)
|
204 |
|
205 |
-
analyze_btn = gr.Button("
|
206 |
|
207 |
-
#
|
208 |
-
gr.Markdown("###
|
209 |
gr.Markdown("""
|
210 |
-
**
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
""")
|
217 |
|
218 |
with gr.Column(scale=2):
|
219 |
analysis_output = gr.Textbox(
|
220 |
-
label="
|
221 |
lines=25,
|
222 |
max_lines=35,
|
223 |
-
placeholder="Upload a file,
|
224 |
interactive=False
|
225 |
)
|
226 |
|
@@ -238,50 +251,15 @@ with gr.Blocks(title="DataForge - AI-Powered File Analysis") as demo:
|
|
238 |
)
|
239 |
|
240 |
gr.Markdown("---")
|
241 |
-
gr.Markdown("## π‘ Example Questions
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
- "Show me authentication errors and user access patterns"
|
249 |
-
- "Are there any brute force attacks or repeated failures?"
|
250 |
-
|
251 |
-
**For Access Logs:**
|
252 |
-
- "Detect unusual access patterns or potential intrusions"
|
253 |
-
- "Find requests with suspicious user agents or payloads"
|
254 |
-
- "Identify high-frequency requests from single IPs"
|
255 |
-
""")
|
256 |
-
|
257 |
-
with gr.Accordion("β‘ Performance Analysis Questions", open=False):
|
258 |
-
gr.Markdown("""
|
259 |
-
**For Application Logs:**
|
260 |
-
- "Which API endpoints are slowest and why?"
|
261 |
-
- "Find performance bottlenecks and response time issues"
|
262 |
-
- "Show me timeout errors and failed requests"
|
263 |
-
- "What are the peak usage times and load patterns?"
|
264 |
-
|
265 |
-
**For System Logs:**
|
266 |
-
- "Identify resource usage spikes and memory issues"
|
267 |
-
- "Find database query performance problems"
|
268 |
-
- "Show me error rates and system health indicators"
|
269 |
-
""")
|
270 |
-
|
271 |
-
with gr.Accordion("π Data Analysis Questions", open=False):
|
272 |
-
gr.Markdown("""
|
273 |
-
**For CSV/Data Files:**
|
274 |
-
- "Analyze data distribution and find statistical insights"
|
275 |
-
- "Identify outliers and anomalies in the dataset"
|
276 |
-
- "What correlations exist between different columns?"
|
277 |
-
- "Generate a comprehensive data quality report"
|
278 |
-
|
279 |
-
**For JSON Files:**
|
280 |
-
- "Parse the structure and extract key information"
|
281 |
-
- "Find patterns in nested data and relationships"
|
282 |
-
- "Summarize the main data points and values"
|
283 |
-
""")
|
284 |
|
285 |
if __name__ == "__main__":
|
286 |
-
print("Starting DataForge
|
|
|
287 |
demo.launch()
|
|
|
62 |
# Store uploaded file path globally
|
63 |
uploaded_file_path = None
|
64 |
|
|
|
|
|
65 |
def handle_file_upload(file):
|
66 |
"""Handle file upload and store the path globally"""
|
67 |
global uploaded_file_path
|
|
|
165 |
return asyncio.run(analyze_uploaded_file())
|
166 |
|
167 |
# Create the Gradio interface
|
168 |
+
with gr.Blocks(title="DataForge - AI CodeAct Agent") as demo:
|
169 |
+
gr.Markdown("# π€ DataForge - AI CodeAct Agent")
|
170 |
gr.Markdown("""
|
171 |
+
## π **AI Writes Code to Analyze Your Data Locally**
|
172 |
+
|
173 |
+
**Why DataForge handles massive files when other AI tools fail:**
|
174 |
|
175 |
+
β **Other AI Tools**: Upload data to LLM β Hit limits β Fail on large files
|
176 |
+
β
**DataForge**: AI writes code β Code processes data locally β No limits!
|
177 |
+
|
178 |
+
### πͺ **Key Benefits:**
|
179 |
+
- **βΎοΈ No Size Limits** - Process GB+ files locally
|
180 |
+
- **π‘οΈ Complete Privacy** - Data never leaves your machine
|
181 |
+
- **β‘ Lightning Fast** - No uploads, pure local processing
|
182 |
+
- **π― Custom Analysis** - Code written for your specific question
|
183 |
+
""")
|
184 |
|
185 |
+
# Supported File Types - Simple Version
|
186 |
+
gr.Markdown("## π **Supported Files**")
|
187 |
+
gr.Markdown("""
|
188 |
+
**π Data:** CSV, JSON, XML, TSV
|
189 |
+
**π Logs:** Application, access, error, audit logs
|
190 |
+
**ποΈ Text:** Any text file, code files, configs
|
191 |
+
**πΎ Size:** No limits - handles multi-GB files locally
|
192 |
""")
|
193 |
|
194 |
with gr.Row():
|
|
|
205 |
interactive=False
|
206 |
)
|
207 |
|
208 |
+
|
209 |
# Question Section
|
210 |
gr.Markdown("### β Ask Your Question")
|
211 |
user_question = gr.Textbox(
|
|
|
215 |
value=""
|
216 |
)
|
217 |
|
218 |
+
analyze_btn = gr.Button("π€ Activate CodeAct Agent", variant="primary", size="lg")
|
219 |
|
220 |
+
# How it works
|
221 |
+
gr.Markdown("### π¬ **How It Works**")
|
222 |
gr.Markdown("""
|
223 |
+
1. **π AI samples** your file structure
|
224 |
+
2. **β‘ AI writes** custom analysis code
|
225 |
+
3. **π Code processes** your entire file locally
|
226 |
+
4. **π Results** delivered to you
|
227 |
+
|
228 |
+
**Your data never leaves your machine!**
|
229 |
""")
|
230 |
|
231 |
with gr.Column(scale=2):
|
232 |
analysis_output = gr.Textbox(
|
233 |
+
label="π€ CodeAct Agent Analysis Results",
|
234 |
lines=25,
|
235 |
max_lines=35,
|
236 |
+
placeholder="Upload a file, ask your question, and click 'Activate CodeAct Agent' to watch the AI write and execute custom analysis code in real-time...",
|
237 |
interactive=False
|
238 |
)
|
239 |
|
|
|
251 |
)
|
252 |
|
253 |
gr.Markdown("---")
|
254 |
+
gr.Markdown("## π‘ **Example Questions**")
|
255 |
+
gr.Markdown("""
|
256 |
+
**π Security:** "Find failed login attempts and suspicious IPs"
|
257 |
+
**β‘ Performance:** "Identify slowest API endpoints and bottlenecks"
|
258 |
+
**π Data:** "Analyze statistical patterns and outliers"
|
259 |
+
**π General:** "Summarize key insights and anomalies"
|
260 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
if __name__ == "__main__":
|
263 |
+
print("π€ Starting DataForge CodeAct Agent Application...")
|
264 |
+
print("π Initializing advanced AI-powered file analysis capabilities...")
|
265 |
demo.launch()
|