SmokeyBandit commited on
Commit
81f2e33
ยท
verified ยท
1 Parent(s): 10248f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +91 -46
app.py CHANGED
@@ -10,7 +10,10 @@ from datetime import datetime, timedelta
10
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
11
  report_summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
12
 
13
- # Business Analysis Functions
 
 
 
14
  def create_performance_comparison():
15
  categories = [
16
  'AI Model Loading',
@@ -20,6 +23,7 @@ def create_performance_comparison():
20
  'Video Processing',
21
  'Large Dataset Analysis'
22
  ]
 
23
  current_values = [20, 15, 10, 25, 12, 18]
24
  potential_values = [100, 100, 100, 100, 100, 100]
25
 
@@ -33,7 +37,8 @@ def create_performance_comparison():
33
  barmode='group',
34
  yaxis_title='Relative Performance (%)',
35
  plot_bgcolor='white',
36
- font={'family': 'Arial', 'size': 14}
 
37
  )
38
  return fig
39
 
@@ -65,7 +70,8 @@ def create_roi_projection():
65
  xaxis_title='Month',
66
  yaxis_title='Revenue (USD)',
67
  plot_bgcolor='white',
68
- font={'family': 'Arial', 'size': 14}
 
69
  )
70
  return fig
71
 
@@ -79,34 +85,37 @@ def calculate_loan_details(loan_amount, interest_rate=5.0):
79
 
80
  monthly_payment = amount * (monthly_rate * (1 + monthly_rate) ** repayment_period) / ((1 + monthly_rate) ** repayment_period - 1)
81
 
82
- schedule = "๐Ÿ“Š Detailed Loan Repayment Schedule\n\n"
83
- schedule += f"๐Ÿ’ฐ Loan Amount: ${amount:,.2f}\n"
84
- schedule += f"โณ Grace Period: {grace_period} months\n"
85
- schedule += f"๐Ÿ“ˆ Annual Interest Rate: {interest_rate}%\n"
86
- schedule += f"๐Ÿ’ต Monthly Payment (starting month {grace_period + 1}): ${monthly_payment:,.2f}\n\n"
87
 
88
  remaining_balance = amount
89
  total_interest = 0
90
  current_date = datetime.now()
91
 
92
- schedule += "Monthly Breakdown:\n"
93
  for month in range(1, repayment_period + grace_period + 1):
94
  date = current_date + timedelta(days=30 * month)
95
  if month <= grace_period:
96
- schedule += f"{date.strftime('%B %Y')}: Grace Period (No Payment)\n"
97
  else:
98
  interest = remaining_balance * monthly_rate
99
  principal = monthly_payment - interest
100
  remaining_balance -= principal
101
  total_interest += interest
102
- schedule += f"{date.strftime('%B %Y')}: ${monthly_payment:,.2f} (Principal: ${principal:,.2f}, Interest: ${interest:,.2f})\n"
103
 
104
- schedule += f"\n๐Ÿ“Š Total Interest Paid: ${total_interest:,.2f}"
105
  return schedule
106
  except ValueError:
107
  return "โš ๏ธ Please enter a valid loan amount"
108
 
109
- # Multi-Agent Functions
 
 
 
110
  def web_scrape_agent(url):
111
  try:
112
  response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'})
@@ -122,7 +131,7 @@ def research_agent(query):
122
  results = ddgs.text(query, max_results=5)
123
  if results:
124
  response = "\n\n".join(
125
- [f"{result.get('title', 'No Title')}:\n{result.get('href', 'No URL')}" for result in results]
126
  )
127
  return response
128
  else:
@@ -184,42 +193,56 @@ def weather_report_agent(city):
184
  except Exception as e:
185
  return f"Error fetching weather data: {e}"
186
 
187
- # Gradio Interface
188
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  gr.Markdown("""
190
- # ๐Ÿš€ Sletcher Systems: Advanced Business & Analysis Platform
191
- ## Comprehensive Business Intelligence and Multi-Agent System
192
  """)
193
-
194
  with gr.Tabs():
195
- # Business Analysis Tabs
196
  with gr.TabItem("๐Ÿข Company Overview"):
197
  with gr.Row():
198
  with gr.Column():
199
  gr.Markdown("""
200
  ### ๐ŸŽฏ Our Vision
201
- Transforming Sletcher Systems into a leading technology solutions provider
202
- through strategic infrastructure investment and intelligent automation.
203
-
204
- ### ๐Ÿ’ช Core Competencies
205
- - ๐Ÿค– Advanced AI Solutions
206
- - ๐ŸŽฎ Game Development
207
- - ๐Ÿ“Š Data Analytics
208
- - ๐Ÿ’ป Custom Software Development
209
  """)
210
  with gr.Column():
211
  gr.Markdown("""
212
- ### ๐Ÿ“ˆ Growth Opportunities
213
- - AI model deployment at scale
214
- - High-performance game development
215
- - Real-time data processing
216
- - Multi-agent system integration
217
-
218
- ### โšก Platform Capabilities
219
- - Automated research and analysis
220
- - Real-time weather monitoring
221
- - Web content extraction
222
- - Strategic planning assistance
223
  """)
224
 
225
  with gr.TabItem("๐Ÿ“Š Performance Analysis"):
@@ -235,8 +258,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
235
  calculate_button = gr.Button("๐Ÿ“Š Calculate Repayment Schedule", variant="primary")
236
  schedule_output = gr.Textbox(label="Detailed Repayment Schedule", lines=15)
237
  calculate_button.click(calculate_loan_details, inputs=[loan_amount, interest_rate], outputs=[schedule_output])
238
-
239
- # Multi-Agent Tabs
240
  with gr.TabItem("๐ŸŒ Web Research"):
241
  with gr.Row():
242
  url_input = gr.Textbox(label="Enter URL for Analysis", placeholder="https://example.com", lines=1)
@@ -249,23 +271,46 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
249
  research_output = gr.Textbox(label="Research Results", lines=10)
250
  scrape_button.click(web_scrape_agent, inputs=url_input, outputs=scrape_output)
251
  research_button.click(research_agent, inputs=research_query, outputs=research_output)
252
-
253
  with gr.TabItem("๐Ÿ“‹ Report Generator"):
254
  report_input = gr.Textbox(label="Enter Content for Summary", placeholder="Paste your text here...", lines=10)
255
  report_button = gr.Button("๐Ÿ“ Generate Report")
256
  report_output = gr.Textbox(label="Generated Summary", lines=6)
257
  report_button.click(report_agent, inputs=report_input, outputs=report_output)
258
-
259
  with gr.TabItem("๐Ÿ“… Project Planning"):
260
  planning_input = gr.Textbox(label="Enter Project Goal", placeholder="E.g., Launch new product line", lines=2)
261
  planning_button = gr.Button("๐ŸŽฏ Generate Plan")
262
  planning_output = gr.Textbox(label="Action Plan", lines=6)
263
  planning_button.click(planning_agent, inputs=planning_input, outputs=planning_output)
264
-
265
  with gr.TabItem("๐ŸŒค๏ธ Weather Monitor"):
266
  city_input = gr.Textbox(label="Enter City Name", placeholder="e.g., London", lines=1)
267
  weather_button = gr.Button("๐ŸŒก๏ธ Get Weather")
268
  weather_output = gr.Textbox(label="Weather Report", lines=3)
269
  weather_button.click(weather_report_agent, inputs=city_input, outputs=weather_output)
270
-
271
- demo.launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
11
  report_summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
12
 
13
+ ##########################################
14
+ # BUSINESS ANALYSIS FUNCTIONS #
15
+ ##########################################
16
+
17
  def create_performance_comparison():
18
  categories = [
19
  'AI Model Loading',
 
23
  'Video Processing',
24
  'Large Dataset Analysis'
25
  ]
26
+ # Current performance (2GB VRAM) vs. potential with an upgraded GPU.
27
  current_values = [20, 15, 10, 25, 12, 18]
28
  potential_values = [100, 100, 100, 100, 100, 100]
29
 
 
37
  barmode='group',
38
  yaxis_title='Relative Performance (%)',
39
  plot_bgcolor='white',
40
+ font={'family': 'Arial', 'size': 14},
41
+ legend={'orientation': 'h', 'x':0.2, 'y':1.1}
42
  )
43
  return fig
44
 
 
70
  xaxis_title='Month',
71
  yaxis_title='Revenue (USD)',
72
  plot_bgcolor='white',
73
+ font={'family': 'Arial', 'size': 14},
74
+ legend={'orientation': 'h', 'x':0.3, 'y':1.1}
75
  )
76
  return fig
77
 
 
85
 
86
  monthly_payment = amount * (monthly_rate * (1 + monthly_rate) ** repayment_period) / ((1 + monthly_rate) ** repayment_period - 1)
87
 
88
+ schedule = "๐Ÿ“Š **Detailed Loan Repayment Schedule**\n\n"
89
+ schedule += f"**๐Ÿ’ฐ Loan Amount:** ${amount:,.2f}\n"
90
+ schedule += f"**โณ Grace Period:** {grace_period} months\n"
91
+ schedule += f"**๐Ÿ“ˆ Annual Interest Rate:** {interest_rate}%\n"
92
+ schedule += f"**๐Ÿ’ต Monthly Payment (starting month {grace_period + 1}):** ${monthly_payment:,.2f}\n\n"
93
 
94
  remaining_balance = amount
95
  total_interest = 0
96
  current_date = datetime.now()
97
 
98
+ schedule += "**Monthly Breakdown:**\n"
99
  for month in range(1, repayment_period + grace_period + 1):
100
  date = current_date + timedelta(days=30 * month)
101
  if month <= grace_period:
102
+ schedule += f"- {date.strftime('%B %Y')}: Grace Period (No Payment)\n"
103
  else:
104
  interest = remaining_balance * monthly_rate
105
  principal = monthly_payment - interest
106
  remaining_balance -= principal
107
  total_interest += interest
108
+ schedule += f"- {date.strftime('%B %Y')}: ${monthly_payment:,.2f} (Principal: ${principal:,.2f}, Interest: ${interest:,.2f})\n"
109
 
110
+ schedule += f"\n**๐Ÿ“Š Total Interest Paid:** ${total_interest:,.2f}"
111
  return schedule
112
  except ValueError:
113
  return "โš ๏ธ Please enter a valid loan amount"
114
 
115
+ ##########################################
116
+ # MULTI-AGENT FUNCTIONS #
117
+ ##########################################
118
+
119
  def web_scrape_agent(url):
120
  try:
121
  response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0'})
 
131
  results = ddgs.text(query, max_results=5)
132
  if results:
133
  response = "\n\n".join(
134
+ [f"**{result.get('title', 'No Title')}**:\n{result.get('href', 'No URL')}" for result in results]
135
  )
136
  return response
137
  else:
 
193
  except Exception as e:
194
  return f"Error fetching weather data: {e}"
195
 
196
+ ##########################################
197
+ # GRADIO INTERFACE #
198
+ ##########################################
199
+
200
+ with gr.Blocks(theme=gr.themes.Soft(), css="""
201
+ /* Custom CSS for header and tabs */
202
+ .header {
203
+ background: linear-gradient(90deg, #4ECB71, #FF6B6B);
204
+ padding: 20px;
205
+ text-align: center;
206
+ color: white;
207
+ font-family: 'Arial', sans-serif;
208
+ }
209
+ .header h1 {
210
+ margin: 0;
211
+ font-size: 36px;
212
+ }
213
+ .header p {
214
+ margin: 5px 0 0;
215
+ font-size: 18px;
216
+ }
217
+ """) as demo:
218
+ # Custom header
219
+ gr.HTML("""
220
+ <div class="header">
221
+ <h1>๐Ÿš€ Sletcher Systems</h1>
222
+ <p>Advanced Business & Multi-Agent Intelligence Platform</p>
223
+ </div>
224
+ """)
225
+
226
  gr.Markdown("""
227
+ ## Welcome!
228
+ Explore our comprehensive suite of tools that leverage state-of-the-art AI for business analysis, strategic planning, and real-time insights.
229
  """)
230
+
231
  with gr.Tabs():
 
232
  with gr.TabItem("๐Ÿข Company Overview"):
233
  with gr.Row():
234
  with gr.Column():
235
  gr.Markdown("""
236
  ### ๐ŸŽฏ Our Vision
237
+ Transform Sletcher Systems into a leading tech solutions provider by integrating cutting-edge AI, immersive game development, and data-driven insights.
 
 
 
 
 
 
 
238
  """)
239
  with gr.Column():
240
  gr.Markdown("""
241
+ ### ๐Ÿ’ช Core Competencies
242
+ - ๐Ÿค– Advanced AI Solutions
243
+ - ๐ŸŽฎ Next-Gen Game Development
244
+ - ๐Ÿ“Š In-Depth Data Analytics
245
+ - ๐Ÿ’ป Custom Software & Multi-Agent Systems
 
 
 
 
 
 
246
  """)
247
 
248
  with gr.TabItem("๐Ÿ“Š Performance Analysis"):
 
258
  calculate_button = gr.Button("๐Ÿ“Š Calculate Repayment Schedule", variant="primary")
259
  schedule_output = gr.Textbox(label="Detailed Repayment Schedule", lines=15)
260
  calculate_button.click(calculate_loan_details, inputs=[loan_amount, interest_rate], outputs=[schedule_output])
261
+
 
262
  with gr.TabItem("๐ŸŒ Web Research"):
263
  with gr.Row():
264
  url_input = gr.Textbox(label="Enter URL for Analysis", placeholder="https://example.com", lines=1)
 
271
  research_output = gr.Textbox(label="Research Results", lines=10)
272
  scrape_button.click(web_scrape_agent, inputs=url_input, outputs=scrape_output)
273
  research_button.click(research_agent, inputs=research_query, outputs=research_output)
274
+
275
  with gr.TabItem("๐Ÿ“‹ Report Generator"):
276
  report_input = gr.Textbox(label="Enter Content for Summary", placeholder="Paste your text here...", lines=10)
277
  report_button = gr.Button("๐Ÿ“ Generate Report")
278
  report_output = gr.Textbox(label="Generated Summary", lines=6)
279
  report_button.click(report_agent, inputs=report_input, outputs=report_output)
280
+
281
  with gr.TabItem("๐Ÿ“… Project Planning"):
282
  planning_input = gr.Textbox(label="Enter Project Goal", placeholder="E.g., Launch new product line", lines=2)
283
  planning_button = gr.Button("๐ŸŽฏ Generate Plan")
284
  planning_output = gr.Textbox(label="Action Plan", lines=6)
285
  planning_button.click(planning_agent, inputs=planning_input, outputs=planning_output)
286
+
287
  with gr.TabItem("๐ŸŒค๏ธ Weather Monitor"):
288
  city_input = gr.Textbox(label="Enter City Name", placeholder="e.g., London", lines=1)
289
  weather_button = gr.Button("๐ŸŒก๏ธ Get Weather")
290
  weather_output = gr.Textbox(label="Weather Report", lines=3)
291
  weather_button.click(weather_report_agent, inputs=city_input, outputs=weather_output)
292
+
293
+ with gr.TabItem("๐Ÿ’ก Personal Pitch"):
294
+ gr.Markdown("""
295
+ ### Why I Need Your Support
296
+ I'm passionate about building cutting-edge applicationsโ€”ranging from retrieval-augmented generation (RAG) systems to immersive game development and advanced AI research.
297
+
298
+ **My vision:**
299
+ - Leverage GPU-accelerated technologies to build scalable, real-time solutions.
300
+ - Transform data into actionable insights that drive business success.
301
+ - Innovate at the intersection of AI, software development, and automation.
302
+
303
+ **What I bring to the table:**
304
+ - Proven ability to build robust apps and multi-agent systems.
305
+ - Hands-on expertise in training state-of-the-art models.
306
+ - A relentless drive to learn and innovate on platforms like Hugging Face Spaces.
307
+
308
+ **The ask:**
309
+ - Your investment in a high-performance GPU will not only accelerate my projects but will also fuel the creation of solutions that have the potential to generate real revenue and transformative impact.
310
+
311
+ Let's build the future together!
312
+ """)
313
+
314
+ gr.Markdown("### Thank you for your time and consideration!")
315
+
316
+ demo.launch(share=True)