Ahmed-Alghamdi commited on
Commit
8629628
·
verified ·
1 Parent(s): 6b0b18e

Delete streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +0 -63
streamlit_app.py DELETED
@@ -1,63 +0,0 @@
1
- import streamlit as st
2
- from main import initialize_system, process_query
3
-
4
- # ---------------------------------------------------------
5
- # Streamlit page configuration
6
- # ---------------------------------------------------------
7
- st.set_page_config(
8
- page_title="Arabic RAG Chatbot 🤖",
9
- page_icon="🤖",
10
- layout="wide",
11
- )
12
-
13
- # ---------------------------------------------------------
14
- # Title and description
15
- # ---------------------------------------------------------
16
- st.title("🤖 Arabic RAG Chatbot")
17
- st.markdown("""
18
- مرحبًا! 👋
19
- اكتب سؤالك بالعربية وسيتولى النظام الإجابة استنادًا إلى مستنداتك المخزّنة محليًا.
20
- """)
21
-
22
- # ---------------------------------------------------------
23
- # Cached system initialization (so it doesn't reload every time)
24
- # ---------------------------------------------------------
25
- @st.cache_resource
26
- def load_rag_system():
27
- search_engine, response_generator = initialize_system()
28
- return search_engine, response_generator
29
-
30
- search_engine, response_generator = load_rag_system()
31
-
32
- # ---------------------------------------------------------
33
- # Input section
34
- # ---------------------------------------------------------
35
- st.divider()
36
- query = st.text_input("📝 أدخل سؤالك هنا:", placeholder="مثال: ما هي نسبة الحضور المطلوبة؟")
37
-
38
- # ---------------------------------------------------------
39
- # Query handling
40
- # ---------------------------------------------------------
41
- if st.button("بحث") or query:
42
- if not query.strip():
43
- st.warning("يرجى كتابة سؤال أولاً.")
44
- else:
45
- with st.spinner("⏳ جارٍ البحث عن الإجابة..."):
46
- try:
47
- response = process_query(query, search_engine, response_generator)
48
- if response:
49
- st.success("💬 الإجابة:")
50
- st.write(response)
51
- else:
52
- st.info("لم يتم العثور على إجابة ذات صلة في المستندات.")
53
- except Exception as e:
54
- st.error(f"حدث خطأ أثناء توليد الإجابة: {e}")
55
-
56
- # ---------------------------------------------------------
57
- # Footer
58
- # ---------------------------------------------------------
59
- st.divider()
60
- st.markdown(
61
- "<p style='text-align:center; color:gray;'>تم التطوير باستخدام Streamlit و RAG ❤️</p>",
62
- unsafe_allow_html=True
63
- )