Omkar1872 commited on
Commit
0c1f912
·
verified ·
1 Parent(s): 79be747

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +5 -5
streamlit_app.py CHANGED
@@ -5,10 +5,10 @@ import docx2txt
5
  import PyPDF2
6
 
7
  # ------------------------------
8
- # Hugging Face Spaces: API Key from Secrets
9
  # ------------------------------
10
- # Set your API key in the Space's Secrets with the name "GROQ_API_KEY"
11
- client = Groq(api_key=os.getenv("GROQ_API_KEY"))
12
 
13
  # ------------------------------
14
  # Streamlit page config and theme
@@ -90,7 +90,7 @@ Requirement:
90
  """
91
  response = client.chat.completions.create(
92
  model="llama-3.1-8b-instant",
93
- messages=[{"role":"user", "content": prompt}],
94
  max_tokens=1500
95
  )
96
  return response.choices[0].message.content
@@ -125,7 +125,7 @@ if generate_btn:
125
 
126
  st.subheader("🔸 Generated Test Cases")
127
  with st.expander("View Test Cases", expanded=True):
128
- st.text(testcases_output)
129
 
130
  st.download_button(
131
  "Download Test Cases as TXT",
 
5
  import PyPDF2
6
 
7
  # ------------------------------
8
+ # Get API key from Hugging Face Secrets
9
  # ------------------------------
10
+ GROQ_API_KEY = os.getenv("GROQ_API_KEY")
11
+ client = Groq(api_key=GROQ_API_KEY)
12
 
13
  # ------------------------------
14
  # Streamlit page config and theme
 
90
  """
91
  response = client.chat.completions.create(
92
  model="llama-3.1-8b-instant",
93
+ messages=[{"role": "user", "content": prompt}],
94
  max_tokens=1500
95
  )
96
  return response.choices[0].message.content
 
125
 
126
  st.subheader("🔸 Generated Test Cases")
127
  with st.expander("View Test Cases", expanded=True):
128
+ st.code(testcases_output, language="text")
129
 
130
  st.download_button(
131
  "Download Test Cases as TXT",