Spaces:
Build error
Build error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +7 -0
src/streamlit_app.py
CHANGED
|
@@ -9,11 +9,18 @@ from openai import OpenAI
|
|
| 9 |
st.set_page_config(page_title="LLM Token Explorer", layout="centered")
|
| 10 |
st.title("🧠 LLM Token & Embedding Explorer")
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
# load_dotenv()
|
| 13 |
# client = OpenAI() # Automatically uses OPENAI_API_KEY from .env
|
| 14 |
# Use API key from Hugging Face secret
|
| 15 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# ---------- Input Section ----------
|
| 18 |
st.header("✍️ Input Text")
|
| 19 |
st.markdown("Enter any short sentence or phrase you'd like to explore. We'll break it down into tokens and explore their structure and meaning.")
|
|
|
|
| 9 |
st.set_page_config(page_title="LLM Token Explorer", layout="centered")
|
| 10 |
st.title("🧠 LLM Token & Embedding Explorer")
|
| 11 |
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
# load_dotenv()
|
| 16 |
# client = OpenAI() # Automatically uses OPENAI_API_KEY from .env
|
| 17 |
# Use API key from Hugging Face secret
|
| 18 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 19 |
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
st.text(f"OpenAI key found: {'Yes' if os.getenv('OPENAI_API_KEY') else 'No'}")
|
| 23 |
+
|
| 24 |
# ---------- Input Section ----------
|
| 25 |
st.header("✍️ Input Text")
|
| 26 |
st.markdown("Enter any short sentence or phrase you'd like to explore. We'll break it down into tokens and explore their structure and meaning.")
|