prasanthr0416 commited on
Commit
c96f2ef
Β·
verified Β·
1 Parent(s): 833f7e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -6
app.py CHANGED
@@ -18,12 +18,22 @@ api_key = st.secrets.get("GROQ_API_KEY") if hasattr(st.secrets, "GROQ_API_KEY")
18
  if not api_key:
19
  api_key = st.text_input("Enter your Groq API Key:", type="password")
20
 
21
- # Model selection
22
  model = st.selectbox(
23
  "Select Model (all free tier):",
24
- ["mixtral-8x7b-32768", "llama2-70b-4096", "gemma2-9b-it"]
 
 
 
 
 
 
25
  )
26
 
 
 
 
 
27
  # Test input
28
  user_input = st.text_area("Enter your test message:", "What is artificial intelligence in 2 sentences?")
29
 
@@ -64,20 +74,31 @@ if st.button("Test API Key", type="primary"):
64
 
65
  except Exception as e:
66
  st.error(f"❌ Error: {str(e)}")
67
- st.info("Make sure you're using a valid Groq API key from console.groq.com")
 
 
 
 
 
 
 
68
 
69
  # Instructions
70
  with st.expander("πŸ“‹ How to use"):
71
  st.markdown("""
72
  1. Get your free API key from [console.groq.com](https://console.groq.com)
73
  2. Enter the key above or add to Hugging Face secrets as `GROQ_API_KEY`
74
- 3. Select a free tier model
75
  4. Type any test message
76
  5. Click "Test API Key"
77
 
78
- All selected models are **completely free** on Groq's free tier!
 
 
 
 
79
  """)
80
 
81
  # Footer
82
  st.markdown("---")
83
- st.markdown("Made with ❀️ to test Groq API | Free Tier Compatible")
 
18
  if not api_key:
19
  api_key = st.text_input("Enter your Groq API Key:", type="password")
20
 
21
+ # Model selection - INCLUDING THE OPENAI MODELS
22
  model = st.selectbox(
23
  "Select Model (all free tier):",
24
+ [
25
+ "openai/gpt-oss-20b", # OpenAI's 20B model
26
+ "openai/gpt-oss-safeguard-20b", # OpenAI with safety features
27
+ "mixtral-8x7b-32768",
28
+ "llama-3.3-70b-versatile",
29
+ "gemma2-9b-it"
30
+ ]
31
  )
32
 
33
+ # Show info about selected model
34
+ if "openai" in model:
35
+ st.info(f"βœ… Using OpenAI model: {model} - Free tier active!")
36
+
37
  # Test input
38
  user_input = st.text_area("Enter your test message:", "What is artificial intelligence in 2 sentences?")
39
 
 
74
 
75
  except Exception as e:
76
  st.error(f"❌ Error: {str(e)}")
77
+
78
+ # Updated requirements.txt
79
+ st.sidebar.markdown("### πŸ“‹ Requirements")
80
+ st.sidebar.code("""
81
+ streamlit==1.43.2
82
+ groq==0.8.0
83
+ httpx==0.27.2
84
+ """)
85
 
86
  # Instructions
87
  with st.expander("πŸ“‹ How to use"):
88
  st.markdown("""
89
  1. Get your free API key from [console.groq.com](https://console.groq.com)
90
  2. Enter the key above or add to Hugging Face secrets as `GROQ_API_KEY`
91
+ 3. Select a model - **including OpenAI's free models!**
92
  4. Type any test message
93
  5. Click "Test API Key"
94
 
95
+ **OpenAI Models Available for Free on Groq:**
96
+ - `openai/gpt-oss-20b` - OpenAI's 20B parameter model
97
+ - `openai/gpt-oss-safeguard-20b` - Same with safety guardrails
98
+
99
+ All models have same limits: 30 req/min, 1K req/day
100
  """)
101
 
102
  # Footer
103
  st.markdown("---")
104
+ st.markdown("Made with ❀️ to test Groq API | OpenAI models included!")