RAHULJUNEJA33 commited on
Commit
04f8251
·
verified ·
1 Parent(s): 825fb76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -44
app.py CHANGED
@@ -2,7 +2,6 @@ import streamlit as st
2
  from transformers import pipeline
3
  from reportlab.lib.pagesizes import letter
4
  from reportlab.pdfgen import canvas
5
- from reportlab.lib import colors
6
  from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
7
  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
8
  import os
@@ -32,47 +31,24 @@ def generate_functional_requirements(topic):
32
 
33
  sections = {
34
  "Introduction": [
35
- "Overview and Background",
36
- "Purpose of the System",
37
- "Intended Users and Audience"
38
  ],
39
  "Scope": [
40
- "General System Description",
41
- "Key Functionalities & Modules",
42
- "Out of Scope Features"
43
  ],
44
  "Functional Specifications": [
45
- "User Roles & Access Levels",
46
- "Main Features and Use Cases",
47
- "Transaction Handling & Workflows"
48
  ],
49
  "Security & Compliance": [
50
  "Regulatory Requirements",
51
- "Data Protection & Encryption",
52
- "Fraud Detection Mechanisms"
53
- ],
54
- "User Interface": [
55
- "Wireframes and UI/UX Considerations",
56
- "Navigation & Accessibility Features"
57
- ],
58
- "System Architecture": [
59
- "High-Level Architecture",
60
- "Technology Stack Used",
61
- "API Integrations"
62
- ],
63
- "Performance & Scalability": [
64
- "Expected Load & System Throughput",
65
- "Response Time Expectations",
66
- "Scalability Strategies"
67
- ],
68
- "Data Management": [
69
- "Data Flow and Storage",
70
- "Backup & Disaster Recovery Strategies"
71
  ],
72
  "Future Enhancements": [
73
  "Potential Feature Expansions",
74
- "Long-Term Roadmap",
75
- "Next Steps in Development"
76
  ]
77
  }
78
 
@@ -84,18 +60,17 @@ def generate_functional_requirements(topic):
84
  document.append(Spacer(1, 10))
85
 
86
  for subsection in subsections:
87
- prompt = f"Write a **detailed 500-word section** on '{subsection}' for the topic '{topic}' in banking. Provide structured paragraphs with examples."
88
-
89
- for _ in range(2): # Increase iterations per subsection
90
- output = generator(prompt, max_length=2048, do_sample=True, temperature=0.7)
91
-
92
- if output and isinstance(output, list) and len(output) > 0 and "generated_text" in output[0]:
93
- document.append(Paragraph(f"<b>{subsection}</b>", styles['Heading2']))
94
- document.append(Spacer(1, 6))
95
- document.append(Paragraph(output[0]["generated_text"], styles['Normal']))
96
- document.append(Spacer(1, 10))
97
- else:
98
- return "Error: Model failed to generate text."
99
 
100
  document.append(PageBreak()) # Add a page break after each major section
101
 
 
2
  from transformers import pipeline
3
  from reportlab.lib.pagesizes import letter
4
  from reportlab.pdfgen import canvas
 
5
  from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
6
  from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
7
  import os
 
31
 
32
  sections = {
33
  "Introduction": [
34
+ "Overview and Purpose",
35
+ "Intended Users"
 
36
  ],
37
  "Scope": [
38
+ "System Description",
39
+ "Key Functionalities"
 
40
  ],
41
  "Functional Specifications": [
42
+ "User Roles",
43
+ "Core Features"
 
44
  ],
45
  "Security & Compliance": [
46
  "Regulatory Requirements",
47
+ "Data Protection"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  ],
49
  "Future Enhancements": [
50
  "Potential Feature Expansions",
51
+ "Roadmap & Next Steps"
 
52
  ]
53
  }
54
 
 
60
  document.append(Spacer(1, 10))
61
 
62
  for subsection in subsections:
63
+ prompt = f"Write a **detailed 300-word section** on '{subsection}' for the topic '{topic}' in banking. Provide structured paragraphs with examples."
64
+
65
+ output = generator(prompt, max_length=1024, do_sample=True, temperature=0.7)
66
+
67
+ if output and isinstance(output, list) and len(output) > 0 and "generated_text" in output[0]:
68
+ document.append(Paragraph(f"<b>{subsection}</b>", styles['Heading2']))
69
+ document.append(Spacer(1, 6))
70
+ document.append(Paragraph(output[0]["generated_text"], styles['Normal']))
71
+ document.append(Spacer(1, 10))
72
+ else:
73
+ return "Error: Model failed to generate text."
 
74
 
75
  document.append(PageBreak()) # Add a page break after each major section
76