Download app.py from ombhojane/quantifi: direct link, hf CLI and curl.
- Browser
- Download file 2.8 kB
-
https://huggingface.co/spaces/ombhojane/quantifi/resolve/main/app.py
- Command line
-
hf download hf://spaces/ombhojane/quantifi/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ombhojane/quantifi/resolve/main/app.py
2.8 kB
| import streamlit as st | |
| import google.generativeai as genai | |
| import os | |
| api_key = os.getenv("GENAI_API_KEY") | |
| genai.configure(api_key=api_key) | |
| generation_config = { | |
| "temperature": 0.9, | |
| "top_p": 1, | |
| "top_k": 50, # Adjusted to allow for more diverse outputs | |
| "max_output_tokens": 2048, | |
| } | |
| safety_settings = [ | |
| {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}, | |
| {"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}, | |
| {"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}, | |
| {"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}, | |
| ] | |
| model = genai.GenerativeModel(model_name="gemini-1.0-pro", | |
| generation_config=generation_config, | |
| safety_settings=safety_settings) | |
| st.title('Project Planner') | |
| project_idea = st.text_area("Describe your coding project idea:", height=150) | |
| must_have_features = st.text_input("List must-have features:") | |
| timeline = st.text_input("What is your timeline for this project?") | |
| if st.button('Generate Project Charter'): | |
| if project_idea and must_have_features and timeline: | |
| prompt = ( | |
| f"The coding project idea is: {project_idea}\n" | |
| f"The must-have features for launch are: {must_have_features}\n" | |
| f"The expected timeline for the project is: {timeline}\n" | |
| "Please analyze the project details and generate a draft project charter document covering the following aspects:\n\n" | |
| "- One-paragraph summarizing the project objectives, key requirements, and outcomes\n" | |
| "- High-level user flow diagram showing the key screens and user journey\n" | |
| "- Breakdown of the high-level technical design and architecture\n" | |
| "- Phase-wise plan from design, development, testing to launch\n" | |
| "- List of roles required like frontend, backend, devops engineers etc.\n" | |
| "- Tools and technologies to be used for the MVP\n" | |
| "- Initial effort estimation overview across product, engineering, testing\n" | |
| "- Biggest areas of risks and assumptions to validate\n\n" | |
| """For the user flow diagram, please use the mermaid JS syntax, for example:\n\n | |
| ```mermaid\n" | |
| "flowchart TD\n" | |
| " A[Ecommerce] --> B{View product} \n" | |
| " B --> C{Add to cart}\n" | |
| " C --> D[Payment]\n" | |
| " D --> E[Order confirmed]\n" | |
| "```\n\n" | |
| 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. | |
| """ | |
| ) | |
| response = model.generate_content([prompt]) | |
| st.write(response.text) | |
| else: | |
| st.error("Please complete all fields to generate the project charter.") | |