ai-puppy commited on
Commit
3f04a52
Β·
1 Parent(s): bb43287
Files changed (2) hide show
  1. README.md +1 -0
  2. app.py +42 -64
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-Powered File Analysis") as demo:
171
- gr.Markdown("# πŸ” DataForge - AI-Powered File Analysis")
172
  gr.Markdown("""
173
- Upload any file and ask specific questions for targeted AI analysis. Our guided approach:
 
 
174
 
175
- 1. πŸ“‹ **Examines** your file structure and patterns automatically
176
- 2. 🎯 **Generates** specific code guidance based on your question
177
- 3. πŸš€ **Executes** enhanced analysis with improved accuracy
 
 
 
 
 
 
178
 
179
- **Simply upload a file and ask any question you want!**
 
 
 
 
 
 
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("πŸ” Run Guided Analysis", variant="primary", size="lg")
206
 
207
- # Analysis Info
208
- gr.Markdown("### ℹ️ How It Works")
209
  gr.Markdown("""
210
- **Guided Analysis Process:**
211
- - 🎯 **Question-aware**: Code generation tailored to your specific question
212
- - πŸ“‹ **Smart examination**: Automatically detects file structure and patterns
213
- - πŸš€ **Dynamic optimization**: Creates targeted analysis approach
214
- - βœ… **Higher accuracy**: Prevents common code generation errors
215
- - πŸ”§ **Quality control**: Built-in validation to avoid syntax issues
216
  """)
217
 
218
  with gr.Column(scale=2):
219
  analysis_output = gr.Textbox(
220
- label="πŸ“Š Guided Analysis Results",
221
  lines=25,
222
  max_lines=35,
223
- placeholder="Upload a file, type your question, and click 'Run Guided Analysis' to see detailed results here...",
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 by File Type")
242
-
243
- with gr.Accordion("πŸ” Security Analysis Questions", open=False):
244
- gr.Markdown("""
245
- **For Log Files:**
246
- - "Find any failed login attempts and suspicious IP addresses"
247
- - "Identify potential security threats or anomalies"
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 application...")
 
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()