SR05 commited on
Commit
34e456a
1 Parent(s): a167399

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +27 -50
main.py CHANGED
@@ -1,59 +1,36 @@
1
  import streamlit as st
2
- from loading_file import df # Load and preprocess data
3
- from dataframe import precomputed_df # Get precomputed nearest applications
4
- from search import search_application # Search functionality
5
 
6
- # Set the page title
7
- st.set_page_config(page_title="Visa Application Status Checker", layout="wide")
8
-
9
- # Application title
10
  st.title("Visa Application Status Checker")
11
 
12
- # Navigation menu for modular structure
13
- menu = ["Home", "Search Application", "About"]
14
- choice = st.sidebar.selectbox("Menu", menu)
15
-
16
- if choice == "Home":
17
- st.subheader("Welcome to the Visa Application Status Checker!")
18
- st.write(
19
- """
20
- This application allows you to:
21
- - Check the status of your Visa Application.
22
- - Find the nearest application records for invalid application numbers.
23
- - Explore real-time Visa updates.
24
- """
25
- )
26
- st.write("Navigate to 'Search Application' to start.")
27
 
28
- elif choice == "Search Application":
29
- st.subheader("Search Your Application Status")
30
-
31
- # Input field for Application Number
32
- user_input = st.text_input("Enter your Application Number (including 'IRL'):")
33
- search_button = st.button("Search") # Search button
 
34
 
35
- if search_button:
36
- if not user_input.isdigit() or len(user_input) > 8:
37
- st.warning("Please enter a valid Application Number with up to 8 digits.")
38
  else:
39
- user_input = int(user_input)
40
- search_result = search_application(user_input)
41
 
42
- if search_result is not None:
43
- decision = search_result["Decision"]
44
- if decision.lower() == "approved":
45
- st.success(f"Congratulations! Your application ({user_input}) is Approved.")
46
- elif decision.lower() == "refused":
47
- st.error(f"Your application ({user_input}) is Refused.")
48
- else:
49
- st.info(f"Your application ({user_input}) has a status of '{decision}'.")
50
  else:
51
- st.warning(f"No record found for Application Number {user_input}.")
52
- else:
53
- st.subheader("About")
54
- st.write(
55
- """
56
- This application was built using **Streamlit** to help users check their Visa application status.
57
- Data is updated in real-time and fetched directly from the official website.
58
- """
59
- )
 
1
  import streamlit as st
2
+ from search import search_application
3
+ from dataframe import precomputed_df
 
4
 
 
 
 
 
5
  st.title("Visa Application Status Checker")
6
 
7
+ # User input for application number
8
+ application_number = st.text_input("Enter your Application Number (include 'IRL' if applicable):")
9
+ search_button = st.button("Search")
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
+ if search_button and application_number:
12
+ try:
13
+ # Parse the application number
14
+ if "IRL" in application_number.upper():
15
+ application_number = int("".join(filter(str.isdigit, application_number.upper().split("IRL")[-1])))
16
+ else:
17
+ application_number = int(application_number)
18
 
19
+ # Validate input length
20
+ if len(str(application_number)) > 8:
21
+ st.warning("Please enter a valid application number with up to 8 digits.")
22
  else:
23
+ result = search_application(application_number)
 
24
 
25
+ if result is not None and isinstance(result, pd.Series):
26
+ # Display exact match
27
+ st.subheader("Exact Match Found")
28
+ st.success(f"Application Number: {result['Application Number']}, Decision: {result['Decision']}")
29
+ elif result is not None:
30
+ # Display nearest records
31
+ st.subheader("Nearest Application Numbers")
32
+ st.table(result[["Application Number", "Decision", "Difference"]])
33
  else:
34
+ st.warning(f"No records found for Application Number {application_number}.")
35
+ except ValueError:
36
+ st.error("Invalid input. Please enter numeric digits only.")