msaifee commited on
Commit
bbf2a27
·
1 Parent(s): a5a6c1f

Set API Key

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -125,23 +125,19 @@ st.markdown("""
125
  """)
126
 
127
  # Sidebar components
128
- def show_sidebar():
129
-
130
- with st.sidebar:
131
- st.subheader("Configuration")
132
-
133
- # Groq API Key Input
134
- api_key = st.session_state["GROQ_API_KEY"] = st.text_input("Groq API Key",type="password")
135
- # Validate API key
136
- if not api_key:
137
- st.warning("⚠️ Please enter your GROQ API key to proceed. Don't have? refer : https://console.groq.com/keys ")
138
 
 
 
 
 
 
 
 
 
 
139
 
140
- if st.button("Reset Session"):
141
- st.session_state.clear()
142
- st.rerun()
143
-
144
- show_sidebar()
145
  # Main content
146
  topic = st.text_input("Enter your blog topic:", placeholder="Generative AI in Healthcare")
147
  generate_btn = st.button("Generate Blog Post")
@@ -153,7 +149,7 @@ if generate_btn:
153
  st.stop()
154
 
155
  try:
156
- st.session_state.llm = ChatGroq(model="qwen-2.5-32b")
157
 
158
  # Initialize and run graph
159
  st.session_state.graph = init_graph()
 
125
  """)
126
 
127
  # Sidebar components
128
+ with st.sidebar:
129
+ st.subheader("Configuration")
 
 
 
 
 
 
 
 
130
 
131
+ # Groq API Key Input
132
+ api_key = st.session_state["GROQ_API_KEY"] = st.text_input("Groq API Key",type="password")
133
+ # Validate API key
134
+ if not api_key:
135
+ st.warning("⚠️ Please enter your GROQ API key to proceed. Don't have? refer : https://console.groq.com/keys ")
136
+
137
+ if st.button("Reset Session"):
138
+ st.session_state.clear()
139
+ st.rerun()
140
 
 
 
 
 
 
141
  # Main content
142
  topic = st.text_input("Enter your blog topic:", placeholder="Generative AI in Healthcare")
143
  generate_btn = st.button("Generate Blog Post")
 
149
  st.stop()
150
 
151
  try:
152
+ st.session_state.llm = ChatGroq(model="qwen-2.5-32b", api_key=api_key)
153
 
154
  # Initialize and run graph
155
  st.session_state.graph = init_graph()