ombhojane commited on
Commit
da1fff4
·
verified ·
1 Parent(s): cbbea8d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import google.generativeai as genai
3
+
4
+ # Configure the Gemini API with your API key
5
+ genai.configure(api_key="YOUR_API_KEY")
6
+
7
+ # Set up the model configuration
8
+ generation_config = {
9
+ "temperature": 0.9,
10
+ "top_p": 1,
11
+ "top_k": 1,
12
+ "max_output_tokens": 2048,
13
+ }
14
+
15
+ safety_settings = [
16
+ {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
17
+ {"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
18
+ {"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
19
+ {"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
20
+ ]
21
+
22
+ model = genai.GenerativeModel(model_name="gemini-1.0-pro",
23
+ generation_config=generation_config,
24
+ safety_settings=safety_settings)
25
+
26
+ # Streamlit app interface
27
+ st.title('CodeBuddy AI Coding Assistant')
28
+
29
+ # Collect project idea
30
+ project_idea = st.text_area("Describe your coding project idea:", height=150)
31
+ if project_idea:
32
+ # Example of asking clarifying questions (expand this based on your needs)
33
+ must_have_features = st.text_input("List must-have features:")
34
+ timeline = st.text_input("What is your timeline for this project?")
35
+
36
+ # When all inputs are provided
37
+ if st.button('Generate Project Charter'):
38
+ prompt_parts = [project_idea, must_have_features, timeline]
39
+ response = model.generate_content(prompt_parts)
40
+ st.write(response.text)