helper.py
Browse files
helper.py
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import os
|
| 3 |
-
import base64
|
| 4 |
-
|
| 5 |
-
def get_openai_api_key():
|
| 6 |
-
# You can set this securely in Streamlit secrets or use environment variable
|
| 7 |
-
api_key = os.getenv("OPENAI_API_KEY", st.secrets.get("OPENAI_API_KEY", ""))
|
| 8 |
-
if not api_key:
|
| 9 |
-
st.error("OpenAI API key not found! Please set it in secrets or env variable.")
|
| 10 |
-
return api_key
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
def visualizeCourses(result, screenshot, target_url, instructions, base_url):
|
| 14 |
-
st.subheader("🔍 Scraping Result")
|
| 15 |
-
for course in result.courses:
|
| 16 |
-
st.markdown(f"### [{course.title}]({course.courseURL})")
|
| 17 |
-
st.image(course.imageUrl, width=400)
|
| 18 |
-
st.write(f"**Presenter(s):** {', '.join(course.presenter)}")
|
| 19 |
-
st.write(f"**Description:** {course.description}")
|
| 20 |
-
st.markdown("---")
|
| 21 |
-
|
| 22 |
-
if screenshot:
|
| 23 |
-
st.subheader("📸 Page Screenshot")
|
| 24 |
-
st.image(screenshot, caption="Full Page Screenshot")
|
| 25 |
-
|
| 26 |
-
with st.expander("🔧 Debug Info"):
|
| 27 |
-
st.code(f"Target URL: {target_url}")
|
| 28 |
-
st.code(f"Instructions: {instructions}")
|
| 29 |
-
st.code(f"Base URL: {base_url}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|