Shivam4096 commited on
Commit
598ea92
·
verified ·
1 Parent(s): 2a29b09

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. web_app/app.py +12 -42
web_app/app.py CHANGED
@@ -144,49 +144,29 @@ st.sidebar.markdown("""
144
  </div>
145
  """, unsafe_allow_html=True)
146
 
147
- _env_nv = os.environ.get("NVIDIA_API_KEY", "")
148
- if _env_nv:
149
- nvidia_key = _env_nv
150
- st.sidebar.success("✅ NVIDIA Key securely loaded.")
151
- else:
152
- st.sidebar.markdown("""
153
  **NVIDIA NIM** *(Llama 3.1 405B / Nemotron)*
154
  <a href='https://build.nvidia.com/explore/discover' target='_blank' style='font-size:0.75rem;color:#34D399;'>Get free key -> build.nvidia.com</a>
155
  """, unsafe_allow_html=True)
156
- nvidia_key = st.sidebar.text_input("NVIDIA API Key", type="password", placeholder="nvapi-...", key="inp_nvidia")
157
 
158
- _env_groq = os.environ.get("GROQ_API_KEY", "")
159
- if _env_groq:
160
- groq_key = _env_groq
161
- st.sidebar.success("✅ Groq Key securely loaded.")
162
- else:
163
- st.sidebar.markdown("""
164
  **Groq** *(Llama 3.3 70B -- fast & free)*
165
  <a href='https://console.groq.com/keys' target='_blank' style='font-size:0.75rem;color:#34D399;'>Get free key -> console.groq.com</a>
166
  """, unsafe_allow_html=True)
167
- groq_key = st.sidebar.text_input("Groq API Key", type="password", placeholder="gsk_...", key="inp_groq")
168
 
169
- _env_gemini = os.environ.get("GEMINI_API_KEY", "")
170
- if _env_gemini:
171
- gemini_key = _env_gemini
172
- st.sidebar.success("✅ Gemini Key securely loaded.")
173
- else:
174
- st.sidebar.markdown("""
175
  **Google Gemini** *(Gemini 2.0 Flash -- free tier)*
176
  <a href='https://aistudio.google.com/app/apikey' target='_blank' style='font-size:0.75rem;color:#34D399;'>Get free key -> aistudio.google.com</a>
177
  """, unsafe_allow_html=True)
178
- gemini_key = st.sidebar.text_input("Gemini API Key", type="password", placeholder="AIza...", key="inp_gemini")
179
 
180
- _env_hf = os.environ.get("HF_API_KEY", "")
181
- if _env_hf:
182
- hf_key = _env_hf
183
- st.sidebar.success("✅ HF Key securely loaded.")
184
- else:
185
- st.sidebar.markdown("""
186
  **Hugging Face** *(Serverless API)*
187
  <a href='https://huggingface.co/settings/tokens' target='_blank' style='font-size:0.75rem;color:#34D399;'>Get free key -> huggingface.co</a>
188
  """, unsafe_allow_html=True)
189
- hf_key = st.sidebar.text_input("Hugging Face API Key", type="password", placeholder="hf_...", key="inp_hf")
190
 
191
  # -- PAID OPTIONS -------------------------------------------------------
192
  st.sidebar.markdown("""
@@ -197,22 +177,12 @@ st.sidebar.markdown("""
197
  """, unsafe_allow_html=True)
198
 
199
  with st.sidebar.expander("Claude (Anthropic) -- paid", expanded=False):
200
- _env_claude = os.environ.get("CLAUDE_API_KEY", "")
201
- if _env_claude:
202
- claude_key = _env_claude
203
- st.success("✅ Claude Key securely loaded.")
204
- else:
205
- st.markdown("<a href='https://console.anthropic.com/' target='_blank' style='font-size:0.75rem;color:#818CF8;'>Get key -> console.anthropic.com</a>", unsafe_allow_html=True)
206
- claude_key = st.text_input("Claude API Key", type="password", placeholder="sk-ant-...", key="inp_claude")
207
 
208
  with st.sidebar.expander("ChatGPT (OpenAI) -- paid", expanded=False):
209
- _env_openai = os.environ.get("OPENAI_API_KEY", "")
210
- if _env_openai:
211
- openai_key = _env_openai
212
- st.success("✅ OpenAI Key securely loaded.")
213
- else:
214
- st.markdown("<a href='https://platform.openai.com/api-keys' target='_blank' style='font-size:0.75rem;color:#818CF8;'>Get key -> platform.openai.com</a>", unsafe_allow_html=True)
215
- openai_key = st.text_input("OpenAI API Key", type="password", placeholder="sk-proj-...", key="inp_openai")
216
 
217
  st.sidebar.markdown("---")
218
 
 
144
  </div>
145
  """, unsafe_allow_html=True)
146
 
147
+ st.sidebar.markdown("""
 
 
 
 
 
148
  **NVIDIA NIM** *(Llama 3.1 405B / Nemotron)*
149
  <a href='https://build.nvidia.com/explore/discover' target='_blank' style='font-size:0.75rem;color:#34D399;'>Get free key -> build.nvidia.com</a>
150
  """, unsafe_allow_html=True)
151
+ nvidia_key = st.sidebar.text_input("NVIDIA API Key", value=os.environ.get("NVIDIA_API_KEY", ""), type="password", placeholder="nvapi-...", key="inp_nvidia")
152
 
153
+ st.sidebar.markdown("""
 
 
 
 
 
154
  **Groq** *(Llama 3.3 70B -- fast & free)*
155
  <a href='https://console.groq.com/keys' target='_blank' style='font-size:0.75rem;color:#34D399;'>Get free key -> console.groq.com</a>
156
  """, unsafe_allow_html=True)
157
+ groq_key = st.sidebar.text_input("Groq API Key", value=os.environ.get("GROQ_API_KEY", ""), type="password", placeholder="gsk_...", key="inp_groq")
158
 
159
+ st.sidebar.markdown("""
 
 
 
 
 
160
  **Google Gemini** *(Gemini 2.0 Flash -- free tier)*
161
  <a href='https://aistudio.google.com/app/apikey' target='_blank' style='font-size:0.75rem;color:#34D399;'>Get free key -> aistudio.google.com</a>
162
  """, unsafe_allow_html=True)
163
+ gemini_key = st.sidebar.text_input("Gemini API Key", value=os.environ.get("GEMINI_API_KEY", ""), type="password", placeholder="AIza...", key="inp_gemini")
164
 
165
+ st.sidebar.markdown("""
 
 
 
 
 
166
  **Hugging Face** *(Serverless API)*
167
  <a href='https://huggingface.co/settings/tokens' target='_blank' style='font-size:0.75rem;color:#34D399;'>Get free key -> huggingface.co</a>
168
  """, unsafe_allow_html=True)
169
+ hf_key = st.sidebar.text_input("Hugging Face API Key", value=os.environ.get("HF_API_KEY", ""), type="password", placeholder="hf_...", key="inp_hf")
170
 
171
  # -- PAID OPTIONS -------------------------------------------------------
172
  st.sidebar.markdown("""
 
177
  """, unsafe_allow_html=True)
178
 
179
  with st.sidebar.expander("Claude (Anthropic) -- paid", expanded=False):
180
+ st.markdown("<a href='https://console.anthropic.com/' target='_blank' style='font-size:0.75rem;color:#818CF8;'>Get key -> console.anthropic.com</a>", unsafe_allow_html=True)
181
+ claude_key = st.text_input("Claude API Key", value=os.environ.get("CLAUDE_API_KEY", ""), type="password", placeholder="sk-ant-...", key="inp_claude")
 
 
 
 
 
182
 
183
  with st.sidebar.expander("ChatGPT (OpenAI) -- paid", expanded=False):
184
+ st.markdown("<a href='https://platform.openai.com/api-keys' target='_blank' style='font-size:0.75rem;color:#818CF8;'>Get key -> platform.openai.com</a>", unsafe_allow_html=True)
185
+ openai_key = st.text_input("OpenAI API Key", value=os.environ.get("OPENAI_API_KEY", ""), type="password", placeholder="sk-proj-...", key="inp_openai")
 
 
 
 
 
186
 
187
  st.sidebar.markdown("---")
188