anasfsd123 commited on
Commit
e28fac2
·
verified ·
1 Parent(s): 48ce55c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,10 +1,12 @@
1
  import os
 
2
  from groq import Groq
3
  import streamlit as st
4
 
 
 
 
5
  # Set Groq API Key
6
- os.environ["GROQ_API_KEY"] = "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"
7
- # Ensure the API key is set in the environment
8
  api_key = os.getenv("GROQ_API_KEY")
9
  if not api_key:
10
  raise ValueError("GROQ_API_KEY is not set in the environment.")
@@ -28,12 +30,8 @@ def chat_with_llm(user_message, model="llama3-8b-8192"):
28
  # Streamlit App
29
  def main():
30
  st.title("Real-Time Text-to-Text Chatbot")
31
- #st.write("Powered by Groq and deployed on Streamlit.")
32
-
33
- # Input text from the user
34
  user_input = st.text_input("You:", "")
35
 
36
- # Display bot's response
37
  if st.button("Send"):
38
  if user_input.strip():
39
  with st.spinner("Thinking..."):
 
1
  import os
2
+ from dotenv import load_dotenv
3
  from groq import Groq
4
  import streamlit as st
5
 
6
+ # Load environment variables
7
+ load_dotenv()
8
+
9
  # Set Groq API Key
 
 
10
  api_key = os.getenv("GROQ_API_KEY")
11
  if not api_key:
12
  raise ValueError("GROQ_API_KEY is not set in the environment.")
 
30
  # Streamlit App
31
  def main():
32
  st.title("Real-Time Text-to-Text Chatbot")
 
 
 
33
  user_input = st.text_input("You:", "")
34
 
 
35
  if st.button("Send"):
36
  if user_input.strip():
37
  with st.spinner("Thinking..."):