Spaces:
Sleeping
Sleeping
Update app.py
Browse files5 unmodified lines678910111213141516171819202122232425262728293031323334353637383940414243150 unmodified lines1941951961971981992005 unmodified lines# Set up Groq client using the environment variable for API key.client = Groq(api_key=os.environ.get("GROQ_API_KEY"))# Define the speaker options and their descriptions.speaker_options = {"Liam": "A male voice","Dorothy": "A female voice",}# Build the Streamlit UI.st.title("Conversation Script Generator Using Groq API")# Layout two columns for speaker selection.col1, col2 = st.columns(2)with col1:left_speaker = st.selectbox("Left Speaker",options=list(speaker_options.keys()),format_func=lambda x: f"{x}: {speaker_options[x]}")with col2:right_speaker = st.selectbox("Right Speaker",options=list(speaker_options.keys()),format_func=lambda x: f"{x}: {speaker_options[x]}")# Text area for overall conversation theme.theme = st.text_area("Overall Theme of the Conversation", height=100)# Optional additional details.additional_details = st.text_area("Additional Conversation Details (Optional)", height=100)# When the user clicks the button, build the prompt and make the API call.if st.button("Generate Conversation"):# Build the prompt message for Groq API.prompt = (f"""150 unmodified lines]# Model selection: adjust as needed.model = "llama-3.3-70b-versatile"try:# Make the chat completion call using Groq.5 unmodified lines67891011121314151617181920212223242526272829303132333435363738394041150 unmodified lines1921931941951961971985 unmodified lines# Set up Groq client using the environment variable for API key.client = Groq(api_key=os.environ.get("GROQ_API_KEY"))# Speaker optionsspeaker_options = {"Liam": "A male voice","Dorothy": "A female voice",}# Build the Streamlit UIst.title("Conversation Script Generator Using Groq API")col1, col2 = st.columns(2)with col1:left_speaker = st.text_input("Left Speaker", placeholder="Enter left speaker name")with col2:right_speaker = st.text_input("Right Speaker", placeholder="Enter right speaker name")# Text area for overall conversation themetheme = st.text_area("Overall Theme of the Conversation", height=100)# Optional additional detailsadditional_details = st.text_area("Additional Conversation Details (Optional)", height=100)# Check if all required fields are filledis_ready = bool(theme and left_speaker and right_speaker)# Disable the button if required fields are not filledif st.button("Generate Conversation", disabled=not is_ready):# Build the prompt message for Groq API.prompt = (f"""150 unmodified lines]# Model selection: adjust as needed.model = "deepseek-r1-distill-llama-70b"try:# Make the chat completion call using Groq.
app.py+16-18