Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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="
|
| 7 |
|
| 8 |
-
#
|
| 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("
|
| 15 |
-
|
| 16 |
-
# Step 1: Proposal
|
| 17 |
-
st.header("
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
st.
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 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=
|
| 39 |
|
| 40 |
-
# Step
|
| 41 |
-
st.header("
|
| 42 |
-
if st.button("
|
|
|
|
| 43 |
proposal_content = f"""
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
if uploaded_files:
|
| 67 |
-
proposal_content += "\n\n## Uploaded Images\n"
|
| 68 |
for uploaded_file in uploaded_files:
|
| 69 |
-
proposal_content += f"![{
|
| 70 |
|
| 71 |
-
#
|
| 72 |
-
|
| 73 |
-
|
| 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 |
-
|
| 79 |
-
st.
|
| 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"\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!")
|