MalikShehram commited on
Commit
ba071c5
·
verified ·
1 Parent(s): b8fec0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -63
app.py CHANGED
@@ -1,80 +1,71 @@
1
  import streamlit as st
2
  from PIL import Image
3
- import os
4
 
5
  # Page Configuration
6
- st.set_page_config(page_title="Proposal Maker", layout="wide")
7
 
8
- # Sidebar
9
- st.sidebar.title("Proposal Maker")
10
- st.sidebar.info("Create professional engineering proposals with images and diagrams.")
11
-
12
- # Main Title
13
  st.title("Proposal Maker")
14
- st.write("This app helps you design detailed engineering proposals, including adding images like block diagrams, model pictures, and real-time photos.")
15
-
16
- # Step 1: Proposal Title
17
- st.header("Step 1: Proposal Title")
18
- title = st.text_input("Enter the title of your proposal", placeholder="E.g., AI-Powered Glucose Monitoring System")
19
-
20
- # Step 2: Proposal Sections
21
- st.header("Step 2: Proposal Sections")
22
- introduction = st.text_area("Introduction", placeholder="Describe the problem and your vision.")
23
- objectives = st.text_area("Objectives", placeholder="List measurable objectives for your proposal.")
24
- methodology = st.text_area("Methodology", placeholder="Explain how the solution will be developed, tested, and deployed.")
25
- timeline = st.text_area("Timeline", placeholder="Provide a timeline or milestones.")
26
- budget = st.text_area("Budget", placeholder="Include a cost breakdown for the project.")
27
- expected_outcomes = st.text_area("Expected Outcomes", placeholder="Describe the benefits and impact of the project.")
28
-
29
- # Step 3: Upload Images
30
- st.header("Step 3: Upload Images")
31
- uploaded_files = st.file_uploader("Upload images (e.g., block diagrams, real-time photos)", accept_multiple_files=True, type=["jpg", "jpeg", "png"])
32
-
33
- # Display uploaded images
34
  if uploaded_files:
35
  st.subheader("Uploaded Images")
36
  for uploaded_file in uploaded_files:
37
  img = Image.open(uploaded_file)
38
- st.image(img, caption=os.path.basename(uploaded_file.name), use_column_width=True)
39
 
40
- # Step 4: Generate and Download Proposal
41
- st.header("Step 4: Generate Proposal")
42
- if st.button("Generate Proposal"):
 
43
  proposal_content = f"""
44
- # {title}
45
-
46
- ## Introduction
47
- {introduction}
48
-
49
- ## Objectives
50
- {objectives}
51
-
52
- ## Methodology
53
- {methodology}
54
-
55
- ## Timeline
56
- {timeline}
57
-
58
- ## Budget
59
- {budget}
60
-
61
- ## Expected Outcomes
62
- {expected_outcomes}
63
- """
64
-
65
- # Adding image captions in the generated proposal
66
  if uploaded_files:
67
- proposal_content += "\n\n## Uploaded Images\n"
68
  for uploaded_file in uploaded_files:
69
- proposal_content += f"![{os.path.basename(uploaded_file.name)}](Uploaded Image)\n"
70
 
71
- # Save to a text file
72
- with open("proposal.md", "w") as f:
73
- f.write(proposal_content)
74
-
75
- st.success("Proposal generated successfully! Download it below.")
76
- st.download_button(label="Download Proposal", data=proposal_content, file_name="proposal.md", mime="text/markdown")
77
 
78
- st.write("---")
79
- st.info("Powered by Streamlit and ready for deployment on Hugging Face!")
80
 
 
 
 
1
  import streamlit as st
2
  from PIL import Image
 
3
 
4
  # Page Configuration
5
+ st.set_page_config(page_title="Proposal Maker", layout="centered")
6
 
7
+ # App Title
 
 
 
 
8
  st.title("Proposal Maker")
9
+ st.write("Easily create engineering proposals with images and detailed sections.")
10
+
11
+ # Step 1: Proposal Details
12
+ st.header("Proposal Details")
13
+ proposal_title = st.text_input("Proposal Title", placeholder="Enter your proposal title here")
14
+ introduction = st.text_area("Introduction", placeholder="Briefly describe the problem and your vision")
15
+ objectives = st.text_area("Objectives", placeholder="List the key objectives of the proposal")
16
+ methodology = st.text_area("Methodology", placeholder="Explain the process to develop and deploy the solution")
17
+ timeline = st.text_area("Timeline", placeholder="Provide a timeline or milestones")
18
+ budget = st.text_area("Budget", placeholder="Describe the budget or cost breakdown")
19
+ expected_outcomes = st.text_area("Expected Outcomes", placeholder="Explain the benefits and expected results")
20
+
21
+ # Step 2: Upload Images
22
+ st.header("Upload Images")
23
+ uploaded_files = st.file_uploader("Add images (e.g., block diagrams, models)", accept_multiple_files=True, type=["png", "jpg", "jpeg"])
24
+
25
+ # Display Uploaded Images
 
 
 
26
  if uploaded_files:
27
  st.subheader("Uploaded Images")
28
  for uploaded_file in uploaded_files:
29
  img = Image.open(uploaded_file)
30
+ st.image(img, caption=uploaded_file.name, use_column_width=True)
31
 
32
+ # Step 3: Generate Proposal
33
+ st.header("Generate Proposal")
34
+ if st.button("Create Proposal"):
35
+ # Generate Proposal Content
36
  proposal_content = f"""
37
+ # {proposal_title}
38
+
39
+ ## Introduction
40
+ {introduction}
41
+
42
+ ## Objectives
43
+ {objectives}
44
+
45
+ ## Methodology
46
+ {methodology}
47
+
48
+ ## Timeline
49
+ {timeline}
50
+
51
+ ## Budget
52
+ {budget}
53
+
54
+ ## Expected Outcomes
55
+ {expected_outcomes}
56
+
57
+ ## Images
58
+ """
59
  if uploaded_files:
 
60
  for uploaded_file in uploaded_files:
61
+ proposal_content += f"![{uploaded_file.name}](Uploaded Image)\n"
62
 
63
+ # Display Proposal Content
64
+ st.subheader("Generated Proposal")
65
+ st.text_area("Proposal", proposal_content, height=300)
 
 
 
66
 
67
+ # Download Proposal
68
+ st.download_button("Download Proposal", proposal_content, file_name="proposal.md", mime="text/markdown")
69
 
70
+ st.write("---")
71
+ st.info("This app is powered by Streamlit and ready for deployment!")