Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
# Function to create proposals in different patterns
|
| 4 |
+
def generate_proposal(text, style="formal"):
|
| 5 |
+
if style == "formal":
|
| 6 |
+
return f"Dear Sir/Madam,\n\nI am writing to propose the following idea:\n\n{text}\n\nSincerely,\nYour Name"
|
| 7 |
+
elif style == "casual":
|
| 8 |
+
return f"Hey there!\n\nI’ve been thinking about this idea:\n\n{text}\n\nLet me know what you think!\nCheers!"
|
| 9 |
+
elif style == "business":
|
| 10 |
+
return f"Subject: Proposal for the Idea\n\nDear [Recipient's Name],\n\nI would like to formally propose the following idea:\n\n{text}\n\nLooking forward to your feedback.\nBest regards,\n[Your Name]"
|
| 11 |
+
else:
|
| 12 |
+
return f"Proposal Idea:\n\n{text}\n\nBest regards,\n[Your Name]"
|
| 13 |
+
|
| 14 |
+
# Streamlit app
|
| 15 |
+
def main():
|
| 16 |
+
st.title("Proposal Generator")
|
| 17 |
+
|
| 18 |
+
# Text area for proposal input
|
| 19 |
+
proposal_text = st.text_area("Write your proposal here...", height=150)
|
| 20 |
+
|
| 21 |
+
# Dropdown to choose the style
|
| 22 |
+
style = st.selectbox("Choose a proposal style:", ["formal", "casual", "business"])
|
| 23 |
+
|
| 24 |
+
# Generate proposal button
|
| 25 |
+
if st.button("Generate Proposal"):
|
| 26 |
+
if proposal_text:
|
| 27 |
+
proposal = generate_proposal(proposal_text, style)
|
| 28 |
+
st.subheader("Generated Proposal:")
|
| 29 |
+
st.markdown(f"```\n{proposal}\n```") # Use markdown to display the output nicely
|
| 30 |
+
else:
|
| 31 |
+
st.warning("Please write your proposal text.")
|
| 32 |
+
|
| 33 |
+
if __name__ == "__main__":
|
| 34 |
+
main()
|