| | |
| | import streamlit as st |
| | import google.generativeai as genai |
| |
|
| | |
| | genai.configure(api_key="AIzaSyAKOjtXWhQKL_wDbFkSYPbfmtQYj2vUMCs") |
| |
|
| | generation_config = { |
| | "temperature": 0.9, |
| | "top_p": 1, |
| | "top_k": 1, |
| | "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) |
| |
|
| | def analyze_task_completion(task_description, code): |
| | prompt_parts = [ |
| | f"Task Description: {task_description}", |
| | f"Developed Code:\n{code}", |
| | "Analyze the developed code and provide the following information:", |
| | "1. Number of tasks assigned", |
| | "2. Number of tasks completed based on the developed code", |
| | "3. Tasks that are still incomplete or missing based on the task description" |
| | ] |
| | response = model.generate_content(prompt_parts) |
| | return response.text |
| |
|
| | def main(): |
| | st.title("Task Completeness Checker") |
| |
|
| | task_description = st.text_area("Enter the task description provided by the product manager:") |
| | code = st.text_area("Enter the code you developed:") |
| |
|
| | if st.button("Analyze"): |
| | if task_description and code: |
| | analysis = analyze_task_completion(task_description, code) |
| | st.success(analysis) |
| | else: |
| | st.warning("Please provide both the task description and the developed code.") |
| |
|
| | if __name__ == "__main__": |
| | main() |