Hug0endob commited on
Commit
b4213c6
Β·
verified Β·
1 Parent(s): e9b734d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -39
app.py CHANGED
@@ -1,39 +1,38 @@
1
- import streamlit as st
2
- import google.generativeai as genai
3
- import os
4
-
5
- # Configure API
6
- my_secret = os.getenv("MY_SECRET_KEY")
7
- genai.configure(api_key=my_secret)
8
-
9
- # Define system prompt
10
- sys_prompt = os.getenv("USER_PROMPT")
11
-
12
- # Initialize the model
13
- model = genai.GenerativeModel(model_name="models/gemini-2.0-flash", system_instruction=sys_prompt)
14
-
15
- # Streamlit UI Configuration
16
- st.set_page_config(page_title="Python Code Reviewer πŸ€–", layout="centered")
17
-
18
- # Title & Introduction
19
- st.title("🐍 Python Code Reviewer πŸ€–")
20
- st.markdown("### Welcome! I can help you debug and improve your Python code. Just paste your code below! πŸš€")
21
-
22
- # Input Text Area
23
- user_query = st.text_area("πŸ’¬ Enter your Python-related code snippet or query:", height=200)
24
-
25
- # Generate Response Button
26
- if st.button("πŸš€ Review Code"):
27
- if user_query.strip():
28
- with st.spinner("Analyzing your code... 🧐"):
29
- response = model.generate_content(user_query)
30
-
31
- # Display Response
32
- st.markdown("### πŸ€– Response:")
33
- st.success(response.text)
34
- else:
35
- st.warning("⚠️ Please enter a Python-related code snippet!")
36
-
37
- # Footer
38
- st.markdown("---")
39
- st.markdown("πŸ› οΈ **Built with Streamlit & Google Gemini AI** | ❀️ _Happy Coding!_ 🐍")
 
1
+ import streamlit as st
2
+ import google.generativeai as genai
3
+ import os
4
+
5
+ # Configure API
6
+ genai.configure(api_key=AIzaSyBiAW2GQLid0HGe9Vs_ReKwkwsSVNegNzs)
7
+
8
+ # Define system prompt
9
+ sys_prompt = os.getenv("USER_PROMPT")
10
+
11
+ # Initialize the model
12
+ model = genai.GenerativeModel(model_name="models/gemini-2.5-flash", system_instruction=sys_prompt)
13
+
14
+ # Streamlit UI Configuration
15
+ st.set_page_config(page_title="Python Code Reviewer πŸ€–", layout="centered")
16
+
17
+ # Title & Introduction
18
+ st.title("🐍 Python Code Reviewer πŸ€–")
19
+ st.markdown("### Welcome! I can help you debug and improve your Python code. Just paste your code below! πŸš€")
20
+
21
+ # Input Text Area
22
+ user_query = st.text_area("πŸ’¬ Enter your Python-related code snippet or query:", height=200)
23
+
24
+ # Generate Response Button
25
+ if st.button("πŸš€ Review Code"):
26
+ if user_query.strip():
27
+ with st.spinner("Analyzing your code... 🧐"):
28
+ response = model.generate_content(user_query)
29
+
30
+ # Display Response
31
+ st.markdown("### πŸ€– Response:")
32
+ st.success(response.text)
33
+ else:
34
+ st.warning("⚠️ Please enter a Python-related code snippet!")
35
+
36
+ # Footer
37
+ st.markdown("---")
38
+ st.markdown("πŸ› οΈ **Built with Streamlit & Google Gemini AI** | ❀️ _Happy Coding!_ 🐍")