Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import google.generativeai as genai
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
genai.configure(api_key="AIzaSyAKOjtXWhQKL_wDbFkSYPbfmtQYj2vUMCs")
|
| 6 |
+
|
| 7 |
+
generation_config = {
|
| 8 |
+
"temperature": 0.9,
|
| 9 |
+
"top_p": 1,
|
| 10 |
+
"top_k": 50,
|
| 11 |
+
"max_output_tokens": 2048,
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
safety_settings = [
|
| 15 |
+
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
|
| 16 |
+
{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
|
| 17 |
+
{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
|
| 18 |
+
{"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
|
| 19 |
+
]
|
| 20 |
+
|
| 21 |
+
model = genai.GenerativeModel(model_name="gemini-1.0-pro",
|
| 22 |
+
generation_config=generation_config,
|
| 23 |
+
safety_settings=safety_settings)
|
| 24 |
+
|
| 25 |
+
st.title('Project Planner')
|
| 26 |
+
|
| 27 |
+
project_idea = st.text_area("Describe your coding project idea:", height=150)
|
| 28 |
+
must_have_features = st.text_input("List must-have features:")
|
| 29 |
+
tech_stack = st.text_input("Enter technology stack of your project:")
|
| 30 |
+
timeline = st.text_input("What is your timeline for this project?")
|
| 31 |
+
|
| 32 |
+
if st.button('Generate Project Charter'):
|
| 33 |
+
if project_idea and must_have_features and tech_stack and timeline:
|
| 34 |
+
prompt = (
|
| 35 |
+
f"The coding project idea is: {project_idea}\n"
|
| 36 |
+
f"The must-have features for launch are: {must_have_features}\n"
|
| 37 |
+
f"The technology stack for the project is: {tech_stack}\n"
|
| 38 |
+
f"The expected timeline for the project is: {timeline}\n\n"
|
| 39 |
+
|
| 40 |
+
"Please analyze the project details and generate a draft project charter document covering the following aspects:\n\n"
|
| 41 |
+
|
| 42 |
+
"- One-paragraph summarizing the project objectives, key requirements, and outcomes\n"
|
| 43 |
+
"- High-level user flow diagrams showing the key screens and user journey (provide multiple examples using mermaid JS syntax if required)\n"
|
| 44 |
+
"- Breakdown of the high-level technical design and architecture\n"
|
| 45 |
+
"- Weekly project plan from design, development, testing to launch\n"
|
| 46 |
+
"- Job roles required like frontend, backend, devops engineers, etc.\n"
|
| 47 |
+
"- Technology stack required to build the product\n"
|
| 48 |
+
"- Initial effort estimation overview across product, engineering, testing\n"
|
| 49 |
+
"- Biggest areas of risks and assumptions to validate\n\n"
|
| 50 |
+
"- Additinal Suggessions for project\n\n"
|
| 51 |
+
|
| 52 |
+
"For the Agile process flow diagram, please use the mermaid JS syntax, for example:\n\n"
|
| 53 |
+
|
| 54 |
+
"Exaple No. 1:\n\n"
|
| 55 |
+
|
| 56 |
+
"```mermaid\n"
|
| 57 |
+
"flowchart TD\n"
|
| 58 |
+
" A[Project Kickoff] --> B[Iteration 1 Planning]\n"
|
| 59 |
+
" B --> C{Sprint 1}\n"
|
| 60 |
+
" C --> D{Sprint Review & Retrospective}\n"
|
| 61 |
+
" D --> E[Iteration 2 Planning]\n"
|
| 62 |
+
" E --> F{Sprint 2}\n"
|
| 63 |
+
" F --> G{Sprint Review & Retrospective}\n"
|
| 64 |
+
" G --> H{...}\n"
|
| 65 |
+
" H --> I[Final Review & Project Closure]\n"
|
| 66 |
+
"```\n\n"
|
| 67 |
+
|
| 68 |
+
"""Example No. 2:\n\n"
|
| 69 |
+
|
| 70 |
+
```mermaid\n"
|
| 71 |
+
"flowchart TD\n"
|
| 72 |
+
" A[Ecommerce] --> B{View product} \n"
|
| 73 |
+
" B --> C{Add to cart}\n"
|
| 74 |
+
" C --> D[Payment]\n"
|
| 75 |
+
" D --> E[Order confirmed]\n"
|
| 76 |
+
"```\n\n"""
|
| 77 |
+
|
| 78 |
+
"""Example No. 3:\n\n"
|
| 79 |
+
'''mermaid\\n"
|
| 80 |
+
"flowchart TD\\n"
|
| 81 |
+
" A[Social Media App] --> B{Login/Signup}\\n"
|
| 82 |
+
" B --> C{News Feed}\\n"
|
| 83 |
+
" C --> D{Post Content}\\n"
|
| 84 |
+
" D --> E{View Profile}\\n"
|
| 85 |
+
"\n\n"""
|
| 86 |
+
|
| 87 |
+
"Provide comprehensive details in each charter section for clarity. Ensure it sets up the key technical guidelines, resource planning, and execution roadmap based on the information provided."
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
response = model.generate_content([prompt])
|
| 91 |
+
st.write(response.text)
|
| 92 |
+
else:
|
| 93 |
+
st.error("Please complete all fields to generate the project charter.")
|