nexusbert commited on
Commit
a07af37
·
1 Parent(s): 604609d

add template

Browse files
Files changed (1) hide show
  1. app.py +32 -14
app.py CHANGED
@@ -194,7 +194,7 @@ def review_pitchdeck(text: str) -> dict:
194
 
195
  deck_text = text[:12000]
196
 
197
- prompt = f"""You are a senior venture capitalist with 15+ years of experience evaluating thousands of pitch decks. You know the patterns that lead to funding vs. ghosting. Based on extensive research analyzing hundreds of decks, these are the critical failure points:
198
 
199
  1. Beautiful decks missing commercial backbone (GTM, financials, market sizing, clear ask)
200
  2. Giant market claims without credibility - claiming $50B TAM instead of sharp, addressable market
@@ -214,7 +214,9 @@ THE 5 CRITICAL QUESTIONS every deck must answer clearly:
214
  4. Why you?
215
  5. What do you need?
216
 
217
- Deck Content:
 
 
218
  {deck_text}
219
 
220
  TASK:
@@ -274,13 +276,17 @@ Produce ONLY valid JSON with these exact fields:
274
  }},
275
  "slide_count": number,
276
  "slide_count_assessment": "optimal (12-14)" | "too_many" | "too_few"
277
- }}
278
-
279
- Be brutally honest. Commercial clarity keeps doors open - GTM and financials get you funded. Emotion opens the door, but logic closes the deal.
280
- """
281
 
282
  try:
 
 
 
 
 
 
283
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=8192).to(model.device)
 
284
  outputs = model.generate(
285
  **inputs,
286
  max_new_tokens=2000,
@@ -291,6 +297,9 @@ Be brutally honest. Commercial clarity keeps doors open - GTM and financials get
291
  )
292
  raw_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
293
 
 
 
 
294
  start = raw_output.find('{')
295
  end = raw_output.rfind('}') + 1
296
 
@@ -320,10 +329,7 @@ def generate_improvement_pointers(review: dict) -> dict:
320
  "improvement_pointers": []
321
  }
322
 
323
- improvement_prompt = f"""You are a pitch deck consultant with expertise from reviewing hundreds of founder decks. Based on this VC review, provide actionable, specific improvement pointers grounded in real-world failure patterns.
324
-
325
- VC Review:
326
- {json.dumps(review, indent=2)}
327
 
328
  Focus on fixing the TOP 10 COMMON FAILURES:
329
  1. Add commercial backbone: GTM plan, financials, market sizing, clear ask
@@ -343,7 +349,10 @@ Generate 5-10 prioritized improvement pointers addressing the specific failures
343
  - What to fix first, second, third
344
  - Slide-by-slide improvements where critical issues were identified
345
  - How to address deal breakers and common failure patterns
346
- - Quick wins vs. strategic changes
 
 
 
347
 
348
  Return ONLY valid JSON:
349
  {{
@@ -360,11 +369,17 @@ Return ONLY valid JSON:
360
  "quick_wins": ["quick fix 1", "quick fix 2"],
361
  "strategic_changes": ["strategic change 1", "strategic change 2"],
362
  "critical_fixes": ["must-fix issue 1", "must-fix issue 2"]
363
- }}
364
- """
365
 
366
  try:
367
- inputs = tokenizer(improvement_prompt, return_tensors="pt", truncation=True, max_length=8192).to(model.device)
 
 
 
 
 
 
 
368
  outputs = model.generate(
369
  **inputs,
370
  max_new_tokens=1500,
@@ -374,6 +389,9 @@ Return ONLY valid JSON:
374
  )
375
  raw_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
376
 
 
 
 
377
  start = raw_output.find('{')
378
  end = raw_output.rfind('}') + 1
379
 
 
194
 
195
  deck_text = text[:12000]
196
 
197
+ system_message = """You are a senior venture capitalist with 15+ years of experience evaluating thousands of pitch decks. You know the patterns that lead to funding vs. ghosting. Based on extensive research analyzing hundreds of decks, these are the critical failure points:
198
 
199
  1. Beautiful decks missing commercial backbone (GTM, financials, market sizing, clear ask)
200
  2. Giant market claims without credibility - claiming $50B TAM instead of sharp, addressable market
 
214
  4. Why you?
215
  5. What do you need?
216
 
217
+ Be brutally honest. Commercial clarity keeps doors open - GTM and financials get you funded. Emotion opens the door, but logic closes the deal."""
218
+
219
+ user_message = f"""Deck Content:
220
  {deck_text}
221
 
222
  TASK:
 
276
  }},
277
  "slide_count": number,
278
  "slide_count_assessment": "optimal (12-14)" | "too_many" | "too_few"
279
+ }}"""
 
 
 
280
 
281
  try:
282
+ messages = [
283
+ {"role": "system", "content": system_message},
284
+ {"role": "user", "content": user_message}
285
+ ]
286
+
287
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
288
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=8192).to(model.device)
289
+
290
  outputs = model.generate(
291
  **inputs,
292
  max_new_tokens=2000,
 
297
  )
298
  raw_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
299
 
300
+ if "<|assistant|>" in raw_output:
301
+ raw_output = raw_output.split("<|assistant|>")[-1]
302
+
303
  start = raw_output.find('{')
304
  end = raw_output.rfind('}') + 1
305
 
 
329
  "improvement_pointers": []
330
  }
331
 
332
+ system_message = """You are a pitch deck consultant with expertise from reviewing hundreds of founder decks. Provide actionable, specific improvement pointers grounded in real-world failure patterns.
 
 
 
333
 
334
  Focus on fixing the TOP 10 COMMON FAILURES:
335
  1. Add commercial backbone: GTM plan, financials, market sizing, clear ask
 
349
  - What to fix first, second, third
350
  - Slide-by-slide improvements where critical issues were identified
351
  - How to address deal breakers and common failure patterns
352
+ - Quick wins vs. strategic changes"""
353
+
354
+ user_message = f"""VC Review:
355
+ {json.dumps(review, indent=2)}
356
 
357
  Return ONLY valid JSON:
358
  {{
 
369
  "quick_wins": ["quick fix 1", "quick fix 2"],
370
  "strategic_changes": ["strategic change 1", "strategic change 2"],
371
  "critical_fixes": ["must-fix issue 1", "must-fix issue 2"]
372
+ }}"""
 
373
 
374
  try:
375
+ messages = [
376
+ {"role": "system", "content": system_message},
377
+ {"role": "user", "content": user_message}
378
+ ]
379
+
380
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
381
+ inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=8192).to(model.device)
382
+
383
  outputs = model.generate(
384
  **inputs,
385
  max_new_tokens=1500,
 
389
  )
390
  raw_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
391
 
392
+ if "<|assistant|>" in raw_output:
393
+ raw_output = raw_output.split("<|assistant|>")[-1]
394
+
395
  start = raw_output.find('{')
396
  end = raw_output.rfind('}') + 1
397