Spaces:
Build error
Build error
Update app.py
Browse files73 unmodified lines74757677787980117 unmodified lines19819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634773 unmodified lines if "401" in error_msg: st.error("❌ Invalid API key: Authentication failed") elif "403" in error_msg:
st.error("❌ API key doesn't have permission to access Groq API") else: st.error(f"❌ Failed to initialize Groq client: {error_msg}")117 unmodified lines markdown_content += self.get_markdown_content(content, level + 1) return markdown_content
def set_custom_theme(): # Add custom CSS st.markdown(""" <style> /* Main theme colors */ :root { --primary-color: #4A6FDC; --secondary-color: #45B7D1; --background-color: #F5F7FF; --text-color: #333333; --accent-color: #FF6B6B; } /* Header styling */ .main-header { background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)); color: white; padding: 1.5rem 1rem; border-radius: 10px; margin-bottom: 2rem; text-align: center; } .main-header h1 { font-weight: 700; margin-bottom: 0.5rem; } .main-header p { font-size: 1.1rem; opacity: 0.9; } /* Card styling */ .stCard { border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); padding: 1.5rem; margin-bottom: 1rem; background-color: white; transition: transform 0.2s ease, box-shadow 0.2s ease; } .stCard:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); } /* Button styling */ .stButton>button { border-radius: 20px; padding: 0.5rem 1.5rem; font-weight: 500; transition: all 0.2s ease; } .primary-button button { background-color: var(--primary-color); color: white; } .secondary-button button { background-color: transparent; color: var(--primary-color); border: 1px solid var(--primary-color); } /* Input method selection */ .input-method-selector { display: flex; justify-content: space-evenly; margin-bottom: 2rem; flex-wrap: wrap; } .input-method-card { width: 140px; height: 120px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; padding: 1rem; margin: 0.5rem; transition: all 0.2s ease; } .input-method-card.selected { border: 2px solid var(--primary-color); background-color: rgba(74, 111, 220, 0.1); } .input-method-card:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); } .input-method-card i { font-size: 2.5rem; margin-bottom: 0.5rem; color: var(--primary-color); } .input-method-card p { font-size: 0.9rem; text-align: center; margin: 0; } /* Note visualization */ .note-section { padding: 1rem; border-radius: 8px; background-color: white; margin-bottom: 1rem; } .note-section h2 { color: var(--primary-color); border-bottom: 1px solid #eaeaea; padding-bottom: 0.5rem; margin-bottom: 0.5rem; } /* Expander customization */ .st-expander { border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); } /* Footer styling */ .footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid #eaeaea; text-align: center; font-size: 0.9rem; color: #888; } </style> """, unsafe_allow_html=True)
# Manual implementation of retry logic (replacing backoff library)def retry_with_exponential_backoff(max_tries=MAX_RETRIES, initial_wait=INITIAL_WAIT, max_wait=MAX_WAIT): """app.py+145