BCopeland64
commited on
Commit
•
de81532
1
Parent(s):
7dc8bdc
Upload ai_documentation_app.py
Browse files- ai_documentation_app.py +66 -0
ai_documentation_app.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from reportlab.pdfgen import canvas
|
3 |
+
|
4 |
+
def generate_pdf(project_title, objectives, metrics_collaborators, metrics_impact, metrics_outcomes,
|
5 |
+
achievements_collaborators, achievements_solutions, achievements_implementation,
|
6 |
+
lessons_collaboration, lessons_creativity, lessons_insights):
|
7 |
+
content = f"AI Innovation Challenges Documentation Template:\n\nProject Title: {project_title}\n"
|
8 |
+
content += f"**Objective:**\n{objectives}\n"
|
9 |
+
content += f"**Metrics:**\n- Collaborator Numbers: {metrics_collaborators} AI experts and innovators engaged.\n"
|
10 |
+
content += f"- Impact Results: {metrics_impact} innovative solutions generated.\n"
|
11 |
+
content += f"- Final Outcomes: {metrics_outcomes} successful implementations or prototypes.\n\n"
|
12 |
+
content += f"**Key Achievements:**\n- Collaborated with {achievements_collaborators} innovators from diverse backgrounds.\n"
|
13 |
+
content += f"- Generated {achievements_solutions} cutting-edge solutions addressing AI challenges.\n"
|
14 |
+
content += f"- Successfully implemented {achievements_implementation} solutions in real-world scenarios.\n\n"
|
15 |
+
content += f"**Lessons Learned:**\n- Importance of interdisciplinary collaboration in AI innovation.\n"
|
16 |
+
content += f"- Strategies for fostering creativity and experimentation.\n"
|
17 |
+
content += f"- Insights into challenges and opportunities in the AI landscape."
|
18 |
+
|
19 |
+
# Generate a PDF
|
20 |
+
pdf_filename = f"{project_title.replace(' ', '_')}_output.pdf"
|
21 |
+
c = canvas.Canvas(pdf_filename)
|
22 |
+
width, height = c._pagesize
|
23 |
+
c.setFont("Helvetica", 12)
|
24 |
+
lines = content.split('\n')
|
25 |
+
for i, line in enumerate(lines):
|
26 |
+
c.drawString(100, height - 100 - i * 12, line)
|
27 |
+
c.save()
|
28 |
+
|
29 |
+
return pdf_filename
|
30 |
+
|
31 |
+
def main():
|
32 |
+
st.title("AI Innovation Challenges Documentation App")
|
33 |
+
|
34 |
+
# Input boxes for each section
|
35 |
+
project_title = st.text_input("Project Title")
|
36 |
+
objectives = st.text_area("Objectives")
|
37 |
+
metrics_collaborators = st.text_input("Collaborator Numbers (Metrics)")
|
38 |
+
metrics_impact = st.text_input("Impact Results (Metrics)")
|
39 |
+
metrics_outcomes = st.text_input("Final Outcomes (Metrics)")
|
40 |
+
achievements_collaborators = st.text_input("Collaborated with (Key Achievements)")
|
41 |
+
achievements_solutions = st.text_input("Generated (Key Achievements)")
|
42 |
+
achievements_implementation = st.text_input("Successfully implemented (Key Achievements)")
|
43 |
+
lessons_collaboration = st.text_area("Importance of interdisciplinary collaboration (Lessons Learned)")
|
44 |
+
lessons_creativity = st.text_area("Strategies for fostering creativity (Lessons Learned)")
|
45 |
+
lessons_insights = st.text_area("Insights into challenges and opportunities (Lessons Learned)")
|
46 |
+
|
47 |
+
# Button to generate PDF
|
48 |
+
if st.button("Generate PDF"):
|
49 |
+
pdf_filename = generate_pdf(project_title, objectives, metrics_collaborators, metrics_impact, metrics_outcomes,
|
50 |
+
achievements_collaborators, achievements_solutions, achievements_implementation,
|
51 |
+
lessons_collaboration, lessons_creativity, lessons_insights)
|
52 |
+
st.success(f"PDF generated successfully! [Download PDF]({pdf_filename})")
|
53 |
+
|
54 |
+
# Download button
|
55 |
+
st.download_button(
|
56 |
+
label="Click to Download",
|
57 |
+
data=open(pdf_filename, "rb").read(),
|
58 |
+
key="download_pdf",
|
59 |
+
file_name=pdf_filename,
|
60 |
+
mime="application/pdf",
|
61 |
+
)
|
62 |
+
|
63 |
+
if __name__ == "__main__":
|
64 |
+
main()
|
65 |
+
|
66 |
+
|