Spaces:
Runtime error
Runtime error
File size: 2,371 Bytes
7d4a6fa 000da56 7d4a6fa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 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.")
|