Spaces:
Paused
Paused
| ο»Ώ# ============================================ | |
| # 1. app.py (ααΌα Streamlit ααααα’ααα) | |
| # ============================================ | |
| import streamlit as st | |
| import openai | |
| import os | |
| st.title("π€ Aruch Mini AI") | |
| # α’αΆα API Key ααΈ Environment Variable (αα»ααααα·ααΆα) | |
| api_key = os.getenv("OPENAI_API_KEY") | |
| if api_key: | |
| openai.api_key = api_key | |
| # ααΌα Streamlit ααααα’ααα... | |
| user_input = st.text_input("αα½ααααα»αααΆα...") | |
| if user_input and api_key: | |
| response = openai.chat.completions.create( | |
| model="gpt-3.5-turbo", | |
| messages=[{"role": "user", "content": user_input}] | |
| ) | |
| st.write(response.choices[0].message.content) | |
| elif user_input and not api_key: | |
| st.warning("β οΈ ααΌαααααα OPENAI_API_KEY αααα»α Settings") |