Spaces:
Paused
Paused
File size: 857 Bytes
63acff4 | 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 | ο»Ώ# ============================================
# 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") |