phxdev commited on
Commit
6b28843
Β·
verified Β·
1 Parent(s): 4ca689a

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +68 -44
app.py CHANGED
@@ -105,9 +105,9 @@ def generate_onepager(topic, target_audience, key_points, tone, length):
105
  length_tokens = {"Short": 200, "Medium": 400, "Long": 600}
106
  max_tokens = length_tokens.get(length, 400)
107
 
108
- # Create an optimized prompt for actual one-pager format
109
  prompt = f"""<|im_start|>system
110
- You are a business consultant who creates compelling one-page documents that drive decisions and action. Your one-pagers are visual, concise, and immediately impactful.
111
  <|im_end|>
112
  <|im_start|>user
113
  Create a compelling one-page business document about "{topic}" for {target_audience}.
@@ -116,20 +116,23 @@ Style: {tone.lower()} but action-oriented
116
  Key points: {key_points}
117
  Length: {length}
118
 
119
- Format as a TRUE one-pager with:
120
- - Bold title and clear audience
121
- - Visual elements (bullets, emojis, sections)
122
- - Concise benefits and value proposition
123
- - Clear next steps and decision points
124
- - Urgency and compelling call to action
125
 
126
- Make it scannable, impactful, and designed to get approval/buy-in.
127
  <|im_end|>
128
  <|im_start|>assistant
129
- {topic.upper()}
130
- {'=' * len(topic)}
131
 
132
- 🎯 FOR: {target_audience.title()}
 
 
 
 
 
133
 
134
  """
135
 
@@ -163,49 +166,70 @@ Make it scannable, impactful, and designed to get approval/buy-in.
163
  return create_structured_onepager(topic, target_audience, key_points, tone)
164
 
165
  def create_structured_onepager(topic, target_audience, key_points, tone):
166
- """Create a structured one-pager when AI generation fails"""
167
 
168
  key_points_list = [point.strip() for point in key_points.split(',') if point.strip()]
169
 
170
- # Create a more concise, visual one-pager format
171
- template = f"""{topic.upper()}
172
- {'=' * len(topic)}
173
-
174
- 🎯 FOR: {target_audience.title()}
175
-
176
- πŸ’‘ WHAT IS IT?
177
- {topic} is a strategic initiative that delivers measurable value through focused implementation and clear outcomes.
178
-
179
- πŸ”‘ KEY BENEFITS:
180
- {chr(10).join([f" βœ“ {point.strip()}" for point in key_points_list[:4]])}
181
-
182
- πŸ“Š THE OPPORTUNITY:
183
- β€’ Immediate impact on core business objectives
184
- β€’ Scalable solution with long-term benefits
185
- β€’ Competitive advantage in the market
186
- β€’ Risk mitigation and operational efficiency
187
 
188
- πŸš€ NEXT STEPS:
189
- 1. ASSESS current state and requirements
190
- 2. PLAN implementation strategy and timeline
191
- 3. EXECUTE with clear milestones and metrics
192
- 4. MEASURE results and optimize performance
193
-
194
- πŸ’° INVESTMENT: Minimal upfront cost for maximum ROI
195
- ⏱️ TIMELINE: Quick wins in 30-60 days, full benefits within 6 months
196
- πŸ“ˆ SUCCESS METRICS: Improved efficiency, reduced costs, enhanced outcomes
197
-
198
- ────────────────────────────────────────────────────────────────
199
- DECISION POINT: Move forward with {topic.lower()} to capture these benefits
200
- Contact: [Your Team] for implementation planning and support"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
  return template
203
 
 
 
 
 
 
204
  # Create the Gradio interface
205
  def create_interface():
206
  with gr.Blocks(title="One-Pager Generator", theme=gr.themes.Soft()) as demo:
207
  gr.Markdown("# πŸ“„ AI One-Pager Generator")
208
- gr.Markdown("Generate compelling, decision-focused one-pagers that drive action and get buy-in!")
209
 
210
  with gr.Row():
211
  with gr.Column(scale=1):
 
105
  length_tokens = {"Short": 200, "Medium": 400, "Long": 600}
106
  max_tokens = length_tokens.get(length, 400)
107
 
108
+ # Create an optimized prompt for actual business document format
109
  prompt = f"""<|im_start|>system
110
+ You are a business consultant who creates professional one-page business documents. Your documents look like real corporate presentations - not markdown. Use ASCII art, boxes, tables, and visual formatting to create documents that look professional when printed or displayed.
111
  <|im_end|>
112
  <|im_start|>user
113
  Create a compelling one-page business document about "{topic}" for {target_audience}.
 
116
  Key points: {key_points}
117
  Length: {length}
118
 
119
+ CRITICAL: Do NOT use markdown formatting (no #, ##, **, etc.). Instead use:
120
+ - ASCII boxes and borders for sections
121
+ - Proper spacing and alignment
122
+ - Visual elements like bullets, arrows, tables
123
+ - Professional document layout
124
+ - Clear headers with borders/lines
125
 
126
+ Make it look like a real business document that could be printed and presented.
127
  <|im_end|>
128
  <|im_start|>assistant
 
 
129
 
130
+ ╔══════════════════════════════════════════════════════════════════════════════╗
131
+ β•‘ {topic.upper()} β•‘
132
+ β•‘ Business Case & Action Plan β•‘
133
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
134
+
135
+ TARGET AUDIENCE: {target_audience.title()}
136
 
137
  """
138
 
 
166
  return create_structured_onepager(topic, target_audience, key_points, tone)
167
 
168
  def create_structured_onepager(topic, target_audience, key_points, tone):
169
+ """Create a structured one-pager that looks like a real business document"""
170
 
171
  key_points_list = [point.strip() for point in key_points.split(',') if point.strip()]
172
 
173
+ # Create a visual one-pager that looks professional, not markdown
174
+ template = f"""
175
+ ╔══════════════════════════════════════════════════════════════════════════════╗
176
+ β•‘ {topic.upper()} β•‘
177
+ β•‘ Business Case & Action Plan β•‘
178
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
 
 
 
 
 
 
 
 
 
 
 
179
 
180
+ TARGET AUDIENCE: {target_audience.title()} DATE: {import_date()}
181
+
182
+ β”Œβ”€ EXECUTIVE SUMMARY ─────────────────────────────────────────────────────────┐
183
+ β”‚ {topic} represents a strategic opportunity to drive significant business β”‚
184
+ β”‚ value through focused implementation. This initiative delivers measurable β”‚
185
+ β”‚ outcomes with clear ROI and competitive advantages. β”‚
186
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
187
+
188
+ βœ“ KEY BENEFITS & VALUE DRIVERS
189
+
190
+ {chr(10).join([f" β–ͺ {point.strip()}" for point in key_points_list[:4]])}
191
+
192
+ ⚑ BUSINESS IMPACT
193
+
194
+ Revenue Growth: 15-30% increase through improved efficiency
195
+ Cost Reduction: 20-25% operational cost savings
196
+ Time to Market: 40-50% faster delivery cycles
197
+ Risk Mitigation: Reduced compliance and operational risks
198
+
199
+ πŸ“‹ IMPLEMENTATION ROADMAP
200
+
201
+ Phase 1 (Month 1-2): Assessment & Planning
202
+ Phase 2 (Month 3-4): Core Implementation
203
+ Phase 3 (Month 5-6): Optimization & Scale
204
+
205
+ πŸ’΅ INVESTMENT SUMMARY
206
+
207
+ Initial Investment: $XXX,XXX (one-time)
208
+ Annual Operating: $XX,XXX (ongoing)
209
+ Break-even Point: 8-12 months
210
+ 3-Year ROI: 250-400%
211
+
212
+ β”Œβ”€ DECISION REQUIRED ─────────────────────────────────────────────────────────┐
213
+ β”‚ APPROVE: Proceed with {topic.lower()} implementation β”‚
214
+ β”‚ TIMELINE: Decision needed by [DATE] to meet Q[X] targets β”‚
215
+ β”‚ NEXT STEP: Schedule planning session with implementation team β”‚
216
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
217
+
218
+ Contact: [Implementation Team] | Email: [team@company.com] | Ext: XXXX
219
+ """
220
 
221
  return template
222
 
223
+ def import_date():
224
+ """Get current date for the one-pager"""
225
+ from datetime import datetime
226
+ return datetime.now().strftime("%B %d, %Y")
227
+
228
  # Create the Gradio interface
229
  def create_interface():
230
  with gr.Blocks(title="One-Pager Generator", theme=gr.themes.Soft()) as demo:
231
  gr.Markdown("# πŸ“„ AI One-Pager Generator")
232
+ gr.Markdown("Generate professional business documents with visual formatting - NOT markdown! Perfect for printing and presentations.")
233
 
234
  with gr.Row():
235
  with gr.Column(scale=1):