import streamlit as st import requests import json # Set up API credentials API_KEY = "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" API_URL = "https://api.groq.com/openai/v1/chat/completions" # Set up Streamlit app st.title("UI Design Problem Bot & AI Product Manager") st.write("This is a bot that helps with common UI design problems and product management challenges.") # Tabs for navigation between the bots tabs = st.selectbox("Choose a Bot", ["UI Design Problem Solver", "AI Product Manager Bot"]) # UI Design Problem Solver Bot if tabs == "UI Design Problem Solver": st.header("UI Design Problem Solver Bot") st.write("Ask the bot about UI design problems such as balancing business goals, managing complexity, and more!") user_input = st.text_input("Your Question:") if user_input: # Send the request to the Groq API response = requests.post( API_URL, headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}, data=json.dumps({ "model": "llama-3.3-70b-versatile", # Groq model name "messages": [{"role": "user", "content": user_input}] }) ) if response.status_code == 200: answer = response.json() st.write("Bot Response:", answer["choices"][0]["message"]["content"]) else: st.write("Error communicating with the API.") # AI Product Manager Bot elif tabs == "AI Product Manager Bot": st.header("AI Product Manager Bot") st.write("Ask the bot about making design trade-offs or clarifying requirements. You can start by typing your question.") user_input = st.text_input("Your Question:") if user_input: # Send the request to the Groq API response = requests.post( API_URL, headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}, data=json.dumps({ "model": "llama-3.3-70b-versatile", # Groq model name "messages": [{"role": "user", "content": user_input}] }) ) if response.status_code == 200: answer = response.json() st.write("Bot Response:", answer["choices"][0]["message"]["content"]) else: st.write("Error communicating with the API.")