SmokeyBandit commited on
Commit
37d7dc5
Β·
verified Β·
1 Parent(s): 80b663e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +115 -301
app.py CHANGED
@@ -27,7 +27,7 @@ except Exception as e:
27
 
28
  def create_performance_comparison():
29
  """
30
- Generates a bar chart comparing the current 2GB VRAM setup with an upgraded GPU.
31
  """
32
  categories = [
33
  'AI Model Loading',
@@ -41,8 +41,8 @@ def create_performance_comparison():
41
  potential_values = [100, 100, 100, 100, 100, 100]
42
 
43
  fig = go.Figure(data=[
44
- go.Bar(name='Current Setup (2GB VRAM)', x=categories, y=current_values, marker_color='#FF6B6B'),
45
- go.Bar(name='Potential (Upgraded GPU)', x=categories, y=potential_values, marker_color='#4ECB71')
46
  ])
47
 
48
  fig.update_layout(
@@ -53,12 +53,11 @@ def create_performance_comparison():
53
  font={'family': 'Arial', 'size': 14},
54
  legend={'orientation': 'h', 'x': 0.2, 'y': 1.1}
55
  )
56
- logging.debug("Performance comparison chart created.")
57
  return fig
58
 
59
  def create_roi_projection():
60
  """
61
- Creates a 24-month ROI projection chart comparing current revenue growth with projected revenue after a GPU upgrade.
62
  """
63
  months = list(range(1, 25))
64
  base_revenue = 1000
@@ -75,11 +74,11 @@ def create_roi_projection():
75
  fig = go.Figure()
76
  fig.add_trace(go.Scatter(
77
  x=months, y=current_revenue, name='Current Revenue',
78
- line={'color': '#FF6B6B', 'width': 3}
79
  ))
80
  fig.add_trace(go.Scatter(
81
  x=months, y=projected_revenue, name='Projected Revenue with GPU Upgrade',
82
- line={'color': '#4ECB71', 'width': 3}
83
  ))
84
 
85
  fig.update_layout(
@@ -90,12 +89,11 @@ def create_roi_projection():
90
  font={'family': 'Arial', 'size': 14},
91
  legend={'orientation': 'h', 'x': 0.3, 'y': 1.1}
92
  )
93
- logging.debug("ROI projection chart created.")
94
  return fig
95
 
96
  def calculate_loan_details(loan_amount, interest_rate=5.0):
97
  """
98
- Calculates and returns a detailed monthly breakdown of a loan repayment schedule.
99
  """
100
  try:
101
  amount = float(loan_amount)
@@ -129,7 +127,6 @@ def calculate_loan_details(loan_amount, interest_rate=5.0):
129
  schedule += f"- {date.strftime('%B %Y')}: ${monthly_payment:,.2f} (Principal: ${principal:,.2f}, Interest: ${interest:,.2f})\n"
130
 
131
  schedule += f"\n**πŸ“Š Total Interest Paid:** ${total_interest:,.2f}"
132
- logging.debug("Loan repayment schedule calculated.")
133
  return schedule
134
  except ValueError:
135
  return "⚠️ Please enter a valid loan amount"
@@ -140,7 +137,7 @@ def calculate_loan_details(loan_amount, interest_rate=5.0):
140
 
141
  def robust_web_scrape_agent(url):
142
  """
143
- Extracts meaningful content from a URL using multiple user-agents and fallback methods.
144
  """
145
  user_agents = [
146
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/115.0.0.0 Safari/537.36",
@@ -148,157 +145,75 @@ def robust_web_scrape_agent(url):
148
  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/114.0.0.0 Safari/537.36",
149
  ]
150
  headers = {'User-Agent': random.choice(user_agents)}
151
- logging.debug("Fetching URL: %s with headers: %s", url, headers)
152
 
153
  try:
154
  response = requests.get(url, headers=headers, timeout=10)
155
  if response.status_code != 200:
156
- logging.error("Error fetching URL %s: Status code %s", url, response.status_code)
157
  return f"Error: Received status code {response.status_code}"
158
 
159
- # Parse HTML using BeautifulSoup and strip unwanted tags
160
  soup = BeautifulSoup(response.text, "html.parser")
161
  for tag in soup(["script", "style", "noscript"]):
162
  tag.decompose()
163
  text = soup.get_text(separator="\n").strip()
164
- logging.debug("Initial extraction length: %d", len(text))
165
 
166
- # Fallback: Use readability if text is too short
167
  if not text or len(text) < 200:
168
- logging.warning("Insufficient content extracted; using fallback extraction.")
169
  try:
170
  from readability import Document
171
  doc = Document(response.text)
172
  extracted_html = doc.summary()
173
  fallback_soup = BeautifulSoup(extracted_html, "html.parser")
174
  text = fallback_soup.get_text(separator="\n").strip()
175
- logging.debug("Fallback extraction length: %d", len(text))
176
  except ImportError:
177
- logging.error("Readability module not available. For better extraction, install readability-lxml.")
178
  except Exception as fallback_error:
179
  logging.error("Fallback extraction failed: %s", fallback_error)
180
 
181
- if not text or len(text) < 200:
182
- logging.error("No substantial content found at URL: %s", url)
183
- return "No substantial content found."
184
-
185
- logging.info("Content extracted successfully from %s", url)
186
- return text
187
  except Exception as e:
188
- logging.exception("Exception during web scraping:")
189
  return f"Error during scraping: {e}"
190
 
191
  def research_agent(query):
192
  """
193
- Performs a web search using DuckDuckGo and returns formatted research results.
194
  """
195
  try:
196
  with DDGS() as ddgs:
197
  results = ddgs.text(query, max_results=5)
198
  if results:
199
- formatted_results = "\n\n".join(
200
- [f"**{result.get('title', 'No Title')}**:\n{result.get('href', 'No URL')}" for result in results]
201
- )
202
- logging.debug("Research results for query: %s", query)
203
- return formatted_results
204
- else:
205
- logging.info("No research results for query: %s", query)
206
- return "No results found."
207
  except Exception as e:
208
- logging.error("Error during research: %s", e)
209
  return f"Error during research: {e}"
210
 
211
  def report_agent(data):
212
  """
213
- Generates a summary report using a transformer model.
214
  """
215
  try:
216
  if not report_summarizer:
217
- return "Report summarization is not available (check your framework installations)."
218
  if len(data.split()) < 30:
219
- return "Input text is too short to generate a summary. Please provide more details."
220
  summary = report_summarizer(data, max_length=130, min_length=30, do_sample=False)
221
- logging.debug("Summary report generated.")
222
  return summary[0]['summary_text']
223
  except Exception as e:
224
- logging.error("Error during report generation: %s", e)
225
  return f"Error during report generation: {e}"
226
 
227
- def planning_agent(goal):
228
- """
229
- Generates a detailed step-by-step action plan based on the provided goal.
230
- """
231
- steps = [
232
- f"Understand the requirements of '{goal}'.",
233
- f"Break down the goal into smaller, manageable tasks.",
234
- f"Prioritize the tasks and assign realistic timelines.",
235
- f"Execute the plan while monitoring progress closely.",
236
- f"Review outcomes and iterate as needed."
237
- ]
238
- logging.debug("Action plan generated for goal: %s", goal)
239
- return "\n".join([f"Step {i+1}: {step}" for i, step in enumerate(steps)])
240
-
241
- def get_coordinates(city):
242
- """
243
- Retrieves geographical coordinates for a given city using the Nominatim API.
244
- """
245
- try:
246
- url = f"https://nominatim.openstreetmap.org/search?city={city}&format=json"
247
- response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'})
248
- data = response.json()
249
- if data:
250
- logging.debug("Coordinates for %s: %s, %s", city, data[0]["lat"], data[0]["lon"])
251
- return data[0]["lat"], data[0]["lon"]
252
- return None, None
253
- except Exception as e:
254
- logging.error("Error fetching coordinates for %s: %s", city, e)
255
- return None, None
256
-
257
- def weather_report_agent(city):
258
- """
259
- Fetches current weather information for the specified city.
260
- """
261
- lat, lon = get_coordinates(city)
262
- if not lat or not lon:
263
- return "City not found. Please check the city name."
264
- try:
265
- url = f"https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}&current_weather=true"
266
- response = requests.get(url)
267
- data = response.json()
268
- if "current_weather" in data:
269
- weather_code = data["current_weather"]["weathercode"]
270
- temp = data["current_weather"]["temperature"]
271
- weather_mapping = {
272
- 0: "Clear sky", 1: "Mainly clear", 2: "Partly cloudy", 3: "Overcast",
273
- 45: "Fog", 48: "Depositing rime fog", 51: "Light drizzle",
274
- 53: "Moderate drizzle", 55: "Dense drizzle", 61: "Slight rain",
275
- 63: "Moderate rain", 65: "Heavy rain", 71: "Slight snowfall",
276
- 73: "Moderate snowfall", 75: "Heavy snowfall", 95: "Thunderstorm"
277
- }
278
- description = weather_mapping.get(weather_code, f"Code {weather_code}")
279
- logging.debug("Weather data fetched for %s", city)
280
- return f"Current weather in {city}:\nTemperature: {temp}Β°C\nCondition: {description}"
281
- return "Could not fetch weather data."
282
- except Exception as e:
283
- logging.error("Error fetching weather data: %s", e)
284
- return f"Error fetching weather data: {e}"
285
-
286
  ##########################################
287
  # EARNINGS PLOT FUNCTION #
288
  ##########################################
289
 
290
  def create_earnings_plot():
291
  """
292
- Plots the earnings history using personal pay data.
293
  """
294
- # Hardcoded personal earnings data
295
  dates = ["2024-12-10", "2024-12-17", "2024-12-24", "2024-12-31", "2025-01-07",
296
  "2025-01-14", "2025-01-21", "2025-01-28", "2025-02-04", "2025-02-11"]
297
  earnings = [156.02, 73.10, 97.07, 116.11, 79.05, 86.62, 54.57, 86.36, 61.50, 79.18]
298
 
299
- # Create a line chart with markers for personal earnings over time
300
  fig = go.Figure(data=go.Scatter(
301
- x=dates, y=earnings, mode='lines+markers', line=dict(color='#4ECB71', width=3)
 
302
  ))
303
  fig.update_layout(
304
  title={'text': 'Personal Earnings History', 'font': {'size': 24}},
@@ -307,229 +222,128 @@ def create_earnings_plot():
307
  plot_bgcolor='white',
308
  font={'family': 'Arial', 'size': 14}
309
  )
310
- logging.debug("Earnings plot created with %d data points.", len(dates))
311
  return fig
312
 
313
  ##########################################
314
  # GRADIO INTERFACE #
315
  ##########################################
316
 
317
- with gr.Blocks(theme=gr.themes.Soft(), css="""
318
- .header {
319
- background: linear-gradient(90deg, #4ECB71, #FF6B6B);
320
- padding: 20px;
321
- text-align: center;
322
- color: white;
323
- font-family: 'Arial', sans-serif;
324
- }
325
- .header h1 {
326
- margin: 0;
327
- font-size: 36px;
328
- }
329
- .header p {
330
- margin: 3px 0 0;
331
- font-size: 18px;
332
- }
333
- """) as demo:
334
- # Custom header section
335
  gr.HTML("""
336
- <div class="header">
337
- <h1>πŸš€ Sletchy Systems</h1>
338
- <p>Empowering Local Offline AI Assistants, RAG-Powered Tools & SaaS Solutions</p>
339
  </div>
340
  """)
341
 
342
- with gr.Tabs(selected=0, visible=True):
343
- # Overview Tab: Vision, Core Competencies, and Live Demo
344
- with gr.TabItem("🏒 Overview"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  with gr.Row():
346
  with gr.Column():
347
  gr.Markdown("""
348
- ### 🎯 Our Vision & Mission
349
- **Sletchy Systems** is dedicated to revolutionizing AI with secure, innovative solutions based on Retrieval Augmented Generation (RAG). Though I leverage many free open source tools (Huggingface Spaces, Google Colab free T100s, UNSLOTH, Axylotyl, TensorBoard, TensorFlow, YOLO models, etc.), running my own inhouse AI system 24/7 demands a serious GPU upgrade.
 
 
350
 
351
- **Focus Areas:**
352
- - **Local Offline AI Assistants:** Advanced systems using Microsoft Graph RAG and multimodel RAGs for uninterrupted operations.
353
- - **Developer Tools:** VS Code extensions that integrate AI into every part of your workflow.
354
- - **SaaS Offerings:** Automated platforms for image/document scanning, labeling, and processing.
355
- - **24/7 Agent Uptime:** Enabling continuous operation of advertising agents, personal assistants, and a mini research lab.
356
  """)
357
  with gr.Column():
358
- gr.Markdown("""
359
- ### πŸ’ͺ Core Competencies & Differentiators
360
- - **Resilience & Innovation:** Born from overcoming adversity as a broke, part-time teacher.
361
- - **Technical Mastery:** Advanced skills across open source and proprietary AI technologies.
362
- - **Revenue-Driven Vision:** Combining SaaS, AI assistants, and marketing automation to turn passion into profit.
363
- """)
364
- gr.Markdown("### πŸ” Live Website Analysis Demo")
365
- with gr.Row():
366
- demo_url = gr.Textbox(label="Company Website", value="https://sletchersystems.com", lines=1)
367
- demo_scrape_button = gr.Button("πŸ” Analyze Website")
368
- demo_output = gr.Textbox(label="Website Analysis", lines=10)
369
- demo_scrape_button.click(robust_web_scrape_agent, inputs=demo_url, outputs=demo_output)
370
-
371
- # Web Research Tab: Search & Scrape Web Content
372
- with gr.TabItem("🌐 Web Research"):
373
  with gr.Row():
374
- url_input = gr.Textbox(label="Enter URL for Analysis", placeholder="https://example.com", lines=1)
375
- research_query = gr.Textbox(label="Research Query", placeholder="Enter your research topic", lines=1)
 
 
 
 
 
376
  with gr.Row():
377
- scrape_button = gr.Button("πŸ” Scrape Website")
378
- research_button = gr.Button("πŸ”Ž Research Topic")
 
 
 
 
 
 
 
379
  with gr.Row():
380
- scrape_output = gr.Textbox(label="Scraped Content", lines=10)
381
  research_output = gr.Textbox(label="Research Results", lines=10)
382
- scrape_button.click(robust_web_scrape_agent, inputs=url_input, outputs=scrape_output)
383
  research_button.click(research_agent, inputs=research_query, outputs=research_output)
384
-
385
- # Performance Tab: Comparative charts
386
- with gr.TabItem("πŸ“Š Performance"):
387
- gr.Plot(value=create_performance_comparison())
388
-
389
- # ROI Tab: Revenue projections with added agent uptime benefits
390
- with gr.TabItem("πŸ’° ROI"):
391
- gr.Plot(value=create_roi_projection())
392
- gr.Markdown("""
393
- **Key ROI Drivers:**
394
- - **24/7 Inhouse AI System:** Upgrading the GPU lets my custom agents run nonstop, powering advertising, personal assistant functions, and a dedicated research lab.
395
- - **Enhanced Productivity:** Faster model training and continuous operation will drive significant revenue increases.
396
- - **Scaling Revenue:** Unlocking new income streams through SaaS solutions and game development projects.
397
- """)
398
-
399
- # Earnings Tab: Display personal earnings and growth potential
400
- with gr.TabItem("πŸ’Έ Earnings"):
401
- gr.Plot(value=create_earnings_plot())
402
- gr.Markdown("""
403
- **Personal Earnings Snapshot:**
404
- - **Balance:** $38.25 (current pay period)
405
- - **Recent Payments:** From $54.57 up to $156.02 over the past weeks.
406
-
407
- **The Harsh Reality:**
408
- I’m a broke, part-time teacher scraping by on weekend work while studying documentation and building code projectsβ€”even a tiny social media app. I have not a dollar to my name. With a GPU upgrade, I can harness my skills to build websites for customers, automate marketing agents, and launch new SaaS projects that truly pay off.
409
- """)
410
-
411
- # Investment Tab: Loan repayment details and financial breakdown
412
- with gr.TabItem("πŸ“ Investment"):
413
  with gr.Row():
414
- loan_amount = gr.Number(label="Investment Amount ($)", value=3000, minimum=1000, maximum=10000)
415
- interest_rate = gr.Slider(label="Annual Interest Rate (%)", minimum=1, maximum=10, value=5, step=0.5)
416
- calculate_button = gr.Button("πŸ“Š Calculate Repayment Schedule", variant="primary")
417
- schedule_output = gr.Textbox(label="Detailed Repayment Schedule", lines=15)
418
- calculate_button.click(calculate_loan_details, inputs=[loan_amount, interest_rate], outputs=[schedule_output])
419
-
420
- # Report Generator Tab: Summarize content with AI
421
- with gr.TabItem("πŸ“‹ Report Generator"):
422
- report_input = gr.Textbox(label="Enter Content for Summary", placeholder="Paste your text here...", lines=10)
423
- report_button = gr.Button("πŸ“ Generate Report")
424
- report_output = gr.Textbox(label="Generated Summary", lines=6)
425
  report_button.click(report_agent, inputs=report_input, outputs=report_output)
426
-
427
- # Project Planning Tab: Actionable project goals and plans
428
- with gr.TabItem("πŸ“… Project Planning"):
429
- planning_input = gr.Textbox(label="Enter Project Goal", placeholder="E.g., Launch new product line", lines=2)
430
- planning_button = gr.Button("🎯 Generate Plan")
431
- planning_output = gr.Textbox(label="Action Plan", lines=6)
432
- planning_button.click(planning_agent, inputs=planning_input, outputs=planning_output)
433
-
434
- # Weather Monitor Tab: Get current weather info
435
- with gr.TabItem("🌀️ Weather Monitor"):
436
- city_input = gr.Textbox(label="Enter City Name", placeholder="e.g., London", lines=1)
437
- weather_button = gr.Button("🌑️ Get Weather")
438
- weather_output = gr.Textbox(label="Weather Report", lines=3)
439
- weather_button.click(weather_report_agent, inputs=city_input, outputs=weather_output)
440
-
441
- # Personal Pitch Tab: Your journey, personal background, and a note for your dad
442
- with gr.TabItem("πŸ’‘ Personal Pitch"):
443
- gr.Markdown("""
444
- ### About Me & My Journey
445
- **Name:** Wayne Sletcher
446
- **Age:** 33
447
- **Background:**
448
- I have overcome a challenging, traumatic childhood to become a resourceful, determined individual. As a part-time teacher and self-taught coder, I work weekends to build projects and harness new skillsβ€”even if it means scraping by on every paycheck.
449
-
450
- **Strengths & Struggles:**
451
- - **Strengths:** Resilience, technical ingenuity, and unwavering determination.
452
- - **Struggles:** Limited funds, a 2GB VRAM setup, and the constant battle to survive.
453
-
454
- **A Note for Dad:**
455
- Dad, I know you worry about me. What I do isn’t easyβ€”it’s groundbreaking work that pushes the limits of free open source tools into a fully operational, inhouse AI system. This loan isn’t just about survival; it’s about thriving and turning my passion into a future where I can build profitable websites, automate marketing, and launch a range of lucrative projects.
456
- """)
457
-
458
- # SaaS Solutions Tab: Detailed description of your revenue model and technical offerings
459
- with gr.TabItem("πŸ–₯️ SaaS Solutions"):
460
  gr.Markdown("""
461
- ### SaaS Offerings & Technical Stack
462
- **Our Products:**
463
- - **Image & Document Processing:**
464
- Automate scanning, labeling, and processing to train custom AI models on company dataβ€”driving actionable insights.
465
- - **Local Offline AI Assistants:**
466
- Leverage Retrieval Augmented Generation (RAG) with advanced modalities (Microsoft Graph RAG, multimodel RAGs) for secure, offline operations.
467
- - **Developer Tools:**
468
- Powerful VS Code extensions that integrate advanced AI functionalities into your workflow.
469
- - **Advertising Agents & Game Development:**
470
- Innovative solutions that generate revenue through targeted advertising and immersive experiences.
471
-
472
- **Technical Stack & Tools:**
473
- - **Languages & Frameworks:** Python, Next.js, React
474
- - **AI & ML:** TensorFlow, PyTorch, LangChain, Transformers
475
- - **Model Management:** Huggingface Spaces, Google Colab (free T100s), UNSLOTH for fine-tuning, Axylotyl integrations, TensorBoard, YOLO models
476
- - **Databases & Cloud:** PostgreSQL with pgvector, MongoDB, AWS cloud infrastructure
477
-
478
- **Revenue Model:**
479
- By transforming free tools into a full-scale inhouse AI system, our SaaS offerings and custom solutions will create sustainable revenue streams through subscriptions, enterprise contracts, and project-based work.
480
- """)
481
-
482
- # Business Plan Tab: A comprehensive look at the company strategy and future projections
483
- with gr.TabItem("πŸ“ˆ Business Plan"):
484
- gr.Markdown("""
485
- ### Comprehensive Business Plan
486
-
487
- #### Executive Summary
488
- Our mission is to lead the AI revolution by delivering secure, innovative solutions through Retrieval Augmented Generation (RAG). We target industries that need offline, privacy-compliant AI analytics while adhering to strict data privacy laws like POPIA.
489
 
490
- #### Company Description
491
- **Sletchy Systems** is a next-generation AI solutions provider specializing in:
492
- - Local offline AI assistants (powered by Microsoft Graph RAG and multimodel RAGs)
493
- - SaaS platforms for image and document processing
494
- - Developer tools, advertising agents, and game development solutions
495
 
496
- #### Market Analysis
497
- - **Local Focus:** Tailored for the unique regulatory and infrastructure landscape.
498
- - **Growth Opportunity:** Filling the gap for secure, offline AI systems and data-driven analytics.
499
- - **Competitive Advantage:** Customized, privacy-compliant solutions that drive operational efficiency.
500
-
501
- #### Product Offerings
502
- - **AI Assistants:** Local, offline systems that operate 24/7.
503
- - **SaaS Platforms:** End-to-end solutions for document scanning, labeling, and processing.
504
- - **Developer Tools:** Extensions that boost productivity and innovation.
505
- - **Advertising & Game Development:** New revenue streams from targeted ads and immersive experiences.
506
-
507
- #### Marketing & Sales Strategy
508
- - **Digital Outreach:** Targeted campaigns through social media and local tech events.
509
- - **Partnerships:** Collaborations with businesses, universities, and tech incubators.
510
- - **Global Vision:** Starting locally with plans to expand regionally.
511
-
512
- #### Financial Projections & ROI
513
- - **Initial Investment:** Approx. ZAR 5 million in technology infrastructure.
514
- - **Revenue Growth:** Projected breakeven by year two, driven by SaaS subscriptions, advertising, and enterprise deals.
515
- - **Enhanced Agent Performance:** A GPU upgrade will power continuous inhouse AI operationsβ€”critical for scaling the business.
516
-
517
- #### Organizational Structure & Operations
518
- - **Team:** A dedicated group of AI experts, developers, and strategic planners.
519
- - **Operations:** Agile, scalable, and continuously evolving.
520
- - **Risk Management:** Comprehensive strategies to address market, technological, and regulatory challenges.
521
-
522
- #### Fundraising & Implementation Timeline
523
- - **Fundraising:** Equity crowdfunding, strategic grants, and partnership investments.
524
- - **Timeline:** Rollout within six months, initially targeting SMEs and scaling regionally.
525
- - **Contingencies:** Prepared strategies to mitigate risks and adapt to market changes.
526
  """)
527
-
528
- # Persistent Ko-fi donation banner (appears across all tabs)
529
- gr.HTML("""
530
- <div style="position: fixed; bottom: 0; width: 100%; background: #4ECB71; color: white; text-align: center; padding: 10px; font-size: 16px; z-index: 9999;">
531
- Support my journey on <a href="https://ko-fi.com/waynesletcher" target="_blank" style="color: white; text-decoration: underline;">Ko-fi</a> and help me thrive!
532
- </div>
533
- """)
534
 
535
  demo.launch(share=True)
 
27
 
28
  def create_performance_comparison():
29
  """
30
+ Generates a bar chart comparing current setup with upgraded GPU.
31
  """
32
  categories = [
33
  'AI Model Loading',
 
41
  potential_values = [100, 100, 100, 100, 100, 100]
42
 
43
  fig = go.Figure(data=[
44
+ go.Bar(name='Current Setup (2GB VRAM)', x=categories, y=current_values, marker_color='#2D3748'),
45
+ go.Bar(name='Potential (Upgraded GPU)', x=categories, y=potential_values, marker_color='#4A5568')
46
  ])
47
 
48
  fig.update_layout(
 
53
  font={'family': 'Arial', 'size': 14},
54
  legend={'orientation': 'h', 'x': 0.2, 'y': 1.1}
55
  )
 
56
  return fig
57
 
58
  def create_roi_projection():
59
  """
60
+ Creates a 24-month ROI projection chart.
61
  """
62
  months = list(range(1, 25))
63
  base_revenue = 1000
 
74
  fig = go.Figure()
75
  fig.add_trace(go.Scatter(
76
  x=months, y=current_revenue, name='Current Revenue',
77
+ line={'color': '#2D3748', 'width': 3}
78
  ))
79
  fig.add_trace(go.Scatter(
80
  x=months, y=projected_revenue, name='Projected Revenue with GPU Upgrade',
81
+ line={'color': '#4A5568', 'width': 3}
82
  ))
83
 
84
  fig.update_layout(
 
89
  font={'family': 'Arial', 'size': 14},
90
  legend={'orientation': 'h', 'x': 0.3, 'y': 1.1}
91
  )
 
92
  return fig
93
 
94
  def calculate_loan_details(loan_amount, interest_rate=5.0):
95
  """
96
+ Calculates detailed monthly loan repayment schedule.
97
  """
98
  try:
99
  amount = float(loan_amount)
 
127
  schedule += f"- {date.strftime('%B %Y')}: ${monthly_payment:,.2f} (Principal: ${principal:,.2f}, Interest: ${interest:,.2f})\n"
128
 
129
  schedule += f"\n**πŸ“Š Total Interest Paid:** ${total_interest:,.2f}"
 
130
  return schedule
131
  except ValueError:
132
  return "⚠️ Please enter a valid loan amount"
 
137
 
138
  def robust_web_scrape_agent(url):
139
  """
140
+ Extracts content from URL using multiple user-agents and fallback methods.
141
  """
142
  user_agents = [
143
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/115.0.0.0 Safari/537.36",
 
145
  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/114.0.0.0 Safari/537.36",
146
  ]
147
  headers = {'User-Agent': random.choice(user_agents)}
 
148
 
149
  try:
150
  response = requests.get(url, headers=headers, timeout=10)
151
  if response.status_code != 200:
 
152
  return f"Error: Received status code {response.status_code}"
153
 
 
154
  soup = BeautifulSoup(response.text, "html.parser")
155
  for tag in soup(["script", "style", "noscript"]):
156
  tag.decompose()
157
  text = soup.get_text(separator="\n").strip()
 
158
 
 
159
  if not text or len(text) < 200:
 
160
  try:
161
  from readability import Document
162
  doc = Document(response.text)
163
  extracted_html = doc.summary()
164
  fallback_soup = BeautifulSoup(extracted_html, "html.parser")
165
  text = fallback_soup.get_text(separator="\n").strip()
 
166
  except ImportError:
167
+ logging.error("Readability module not available.")
168
  except Exception as fallback_error:
169
  logging.error("Fallback extraction failed: %s", fallback_error)
170
 
171
+ return text if text and len(text) >= 200 else "No substantial content found."
 
 
 
 
 
172
  except Exception as e:
 
173
  return f"Error during scraping: {e}"
174
 
175
  def research_agent(query):
176
  """
177
+ Performs web search using DuckDuckGo.
178
  """
179
  try:
180
  with DDGS() as ddgs:
181
  results = ddgs.text(query, max_results=5)
182
  if results:
183
+ return "\n\n".join([f"**{result.get('title', 'No Title')}**:\n{result.get('href', 'No URL')}" for result in results])
184
+ return "No results found."
 
 
 
 
 
 
185
  except Exception as e:
 
186
  return f"Error during research: {e}"
187
 
188
  def report_agent(data):
189
  """
190
+ Generates summary report using transformer model.
191
  """
192
  try:
193
  if not report_summarizer:
194
+ return "Report summarization is not available."
195
  if len(data.split()) < 30:
196
+ return "Input text is too short for summarization."
197
  summary = report_summarizer(data, max_length=130, min_length=30, do_sample=False)
 
198
  return summary[0]['summary_text']
199
  except Exception as e:
 
200
  return f"Error during report generation: {e}"
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  ##########################################
203
  # EARNINGS PLOT FUNCTION #
204
  ##########################################
205
 
206
  def create_earnings_plot():
207
  """
208
+ Plots earnings history.
209
  """
 
210
  dates = ["2024-12-10", "2024-12-17", "2024-12-24", "2024-12-31", "2025-01-07",
211
  "2025-01-14", "2025-01-21", "2025-01-28", "2025-02-04", "2025-02-11"]
212
  earnings = [156.02, 73.10, 97.07, 116.11, 79.05, 86.62, 54.57, 86.36, 61.50, 79.18]
213
 
 
214
  fig = go.Figure(data=go.Scatter(
215
+ x=dates, y=earnings, mode='lines+markers',
216
+ line=dict(color='#4A5568', width=3)
217
  ))
218
  fig.update_layout(
219
  title={'text': 'Personal Earnings History', 'font': {'size': 24}},
 
222
  plot_bgcolor='white',
223
  font={'family': 'Arial', 'size': 14}
224
  )
 
225
  return fig
226
 
227
  ##########################################
228
  # GRADIO INTERFACE #
229
  ##########################################
230
 
231
+ with gr.Blocks(theme=gr.themes.Default(
232
+ primary_hue="slate",
233
+ secondary_hue="slate",
234
+ neutral_hue="slate",
235
+ font=["Arial", "sans-serif"]
236
+ )) as demo:
237
+ # Ko-fi banner at top
238
+ gr.HTML("""
239
+ <div style="background: #2D3748; color: white; text-align: center; padding: 10px; font-size: 16px;">
240
+ Support this project on <a href="https://ko-fi.com/waynesletcher" target="_blank" style="color: #A0AEC0; text-decoration: underline;">Ko-fi</a>
241
+ </div>
242
+ """)
243
+
244
+ # Header
 
 
 
 
245
  gr.HTML("""
246
+ <div style="background: linear-gradient(90deg, #2D3748, #4A5568); padding: 20px; text-align: center; color: white;">
247
+ <h1 style="margin: 0; font-size: 36px;">Sletcher Systems: Business Expansion Proposal</h1>
248
+ <p style="margin: 10px 0 0; font-size: 18px;">Scaling AI Innovation through Strategic Investment</p>
249
  </div>
250
  """)
251
 
252
+ with gr.Tabs():
253
+ # Executive Summary
254
+ with gr.TabItem("πŸ“‹ Executive Summary"):
255
+ gr.Markdown("""
256
+ ### Vision & Opportunity
257
+ Sletcher Systems aims to scale our AI development capabilities through strategic GPU infrastructure investment.
258
+
259
+ ### Current Challenges
260
+ - Limited by 2GB VRAM setup
261
+ - Running at capacity with current projects
262
+ - Unable to take on larger clients
263
+
264
+ ### Investment Request
265
+ - Amount: $3,000 for GPU upgrade
266
+ - ROI Timeline: 12-24 months
267
+ - Clear path to expanded services
268
+ """)
269
+ gr.Plot(value=create_performance_comparison())
270
+
271
+ # Market & Technical Analysis
272
+ with gr.TabItem("πŸ“Š Market Analysis"):
273
  with gr.Row():
274
  with gr.Column():
275
  gr.Markdown("""
276
+ ### Target Market
277
+ - Small to medium businesses
278
+ - Educational institutions
279
+ - Software development firms
280
 
281
+ ### Market Size
282
+ - Local AI services market: $50M annually
283
+ - 25% YoY growth
284
+ - Untapped potential
 
285
  """)
286
  with gr.Column():
287
+ gr.Plot(value=create_roi_projection())
288
+
289
+ # Technical Capabilities
290
+ with gr.TabItem("πŸ’» Technical Stack"):
291
+ gr.Markdown("""
292
+ ### Current Stack
293
+ - Python, TensorFlow, PyTorch
294
+ - Web Development (React, Next.js)
295
+ - Cloud Infrastructure
296
+
297
+ ### Planned Expansion
298
+ - Advanced AI Model Training
299
+ - Real-time Processing
300
+ - Expanded Service Offerings
301
+ """)
302
  with gr.Row():
303
+ demo_url = gr.Textbox(label="Analyze Website", value="https://sletchersystems.com")
304
+ demo_output = gr.Textbox(label="Analysis Results", lines=10)
305
+ demo_button = gr.Button("πŸ” Analyze")
306
+ demo_button.click(robust_web_scrape_agent, inputs=demo_url, outputs=demo_output)
307
+
308
+ # Financial Plan
309
+ with gr.TabItem("πŸ’° Financial Plan"):
310
  with gr.Row():
311
+ loan_amount = gr.Number(label="Investment Amount ($)", value=3000)
312
+ interest_rate = gr.Slider(label="Annual Interest Rate (%)", value=5)
313
+ calculate_button = gr.Button("Calculate Repayment Schedule")
314
+ schedule_output = gr.Textbox(label="Repayment Details", lines=15)
315
+ calculate_button.click(calculate_loan_details, inputs=[loan_amount, interest_rate], outputs=schedule_output)
316
+ gr.Plot(value=create_earnings_plot())
317
+
318
+ # Research & Development
319
+ with gr.TabItem("πŸ”¬ R&D"):
320
  with gr.Row():
321
+ research_query = gr.Textbox(label="Research Topic", placeholder="Enter research topic...")
322
  research_output = gr.Textbox(label="Research Results", lines=10)
323
+ research_button = gr.Button("πŸ”Ž Research")
324
  research_button.click(research_agent, inputs=research_query, outputs=research_output)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  with gr.Row():
326
+ report_input = gr.Textbox(label="Report Text", placeholder="Enter report text...")
327
+ report_output = gr.Textbox(label="Report Summary", lines=10)
328
+ report_button = gr.Button("πŸ“‘ Summarize Report")
 
 
 
 
 
 
 
 
329
  report_button.click(report_agent, inputs=report_input, outputs=report_output)
330
+ # Implementation Plan
331
+ with gr.TabItem("πŸ“… Timeline"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  gr.Markdown("""
333
+ ### Phase 1: Infrastructure (Month 1)
334
+ - GPU procurement and setup
335
+ - System integration
336
+ - Initial testing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
 
338
+ ### Phase 2: Service Expansion (Months 2-3)
339
+ - New service rollout
340
+ - Client outreach
341
+ - Project pipeline development
 
342
 
343
+ ### Phase 3: Growth (Months 4-12)
344
+ - Market expansion
345
+ - Team growth
346
+ - Revenue scaling
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  """)
 
 
 
 
 
 
 
348
 
349
  demo.launch(share=True)