File size: 1,971 Bytes
d511090
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# app.py
import streamlit as st
import google.generativeai as genai

# Configure the Gemini LLM
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()