Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import json
|
3 |
import os
|
4 |
-
from
|
5 |
-
from calendar_rag import (
|
6 |
-
create_default_config,
|
7 |
-
AcademicCalendarRAG,
|
8 |
-
PipelineConfig
|
9 |
-
)
|
10 |
|
11 |
# Page config
|
12 |
st.set_page_config(
|
@@ -25,14 +20,10 @@ def initialize_pipeline():
|
|
25 |
# Get OpenAI API key from environment variable or Streamlit secrets
|
26 |
openai_api_key = os.getenv('OPENAI_API_KEY') or st.secrets['OPENAI_API_KEY']
|
27 |
|
28 |
-
# Create config
|
29 |
config = create_default_config(openai_api_key)
|
30 |
config.localization.enable_thai_normalization = True
|
31 |
-
|
32 |
-
config.model.temperature = 0.3
|
33 |
-
|
34 |
-
# Initialize pipeline
|
35 |
-
pipeline = AcademicCalendarRAG(config)
|
36 |
|
37 |
# Load calendar data
|
38 |
with open("calendar.json", "r", encoding="utf-8") as f:
|
@@ -108,9 +99,6 @@ def main():
|
|
108 |
- การสอบ
|
109 |
- วันหยุด
|
110 |
""")
|
111 |
-
|
112 |
-
st.markdown("### ⏰ สถานะระบบ")
|
113 |
-
st.write(f"Last Updated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
114 |
|
115 |
if __name__ == "__main__":
|
116 |
main()
|
|
|
1 |
import streamlit as st
|
2 |
import json
|
3 |
import os
|
4 |
+
from calendar_rag import create_default_config, CalendarRAG
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Page config
|
7 |
st.set_page_config(
|
|
|
20 |
# Get OpenAI API key from environment variable or Streamlit secrets
|
21 |
openai_api_key = os.getenv('OPENAI_API_KEY') or st.secrets['OPENAI_API_KEY']
|
22 |
|
23 |
+
# Create config and initialize pipeline
|
24 |
config = create_default_config(openai_api_key)
|
25 |
config.localization.enable_thai_normalization = True
|
26 |
+
pipeline = CalendarRAG(config)
|
|
|
|
|
|
|
|
|
27 |
|
28 |
# Load calendar data
|
29 |
with open("calendar.json", "r", encoding="utf-8") as f:
|
|
|
99 |
- การสอบ
|
100 |
- วันหยุด
|
101 |
""")
|
|
|
|
|
|
|
102 |
|
103 |
if __name__ == "__main__":
|
104 |
main()
|