Update my_model/utilities/ui_manager.py
Browse files
my_model/utilities/ui_manager.py
CHANGED
@@ -18,26 +18,34 @@ class UIManager:
|
|
18 |
"More Pages will follow .. ": self.display_placeholder
|
19 |
}
|
20 |
|
|
|
21 |
def add_tab(self, tab_name, display_function):
|
22 |
"""Adds a new tab to the UI."""
|
23 |
self.tabs[tab_name] = display_function
|
24 |
|
|
|
25 |
def display_sidebar(self):
|
26 |
"""Displays the sidebar for navigation."""
|
|
|
27 |
st.sidebar.title("Navigation")
|
28 |
selection = st.sidebar.radio("Go to", list(self.tabs.keys()))
|
29 |
return selection
|
|
|
30 |
|
31 |
def display_selected_page(self, selection):
|
32 |
"""Displays the selected page based on user's choice."""
|
|
|
33 |
if selection in self.tabs:
|
34 |
self.tabs[selection]()
|
35 |
|
|
|
36 |
def display_home(self):
|
37 |
"""Displays the Home page of the application."""
|
|
|
38 |
st.markdown("<h1 style='text-align: center;'>MultiModal Learning for Visual Question Answering using World Knowledge</h1>", unsafe_allow_html=True)
|
39 |
st.write(" ")
|
40 |
st.markdown("<h2 style='text-align: center;'>(Knowledge-Based Visual Question Answering)</h2>", unsafe_allow_html=True)
|
|
|
41 |
st.write("""\n\nThis application is an interactive element of the project as part of the dissertation for Masters degree in Artificial Intelligence at the [University of Bath](https://www.bath.ac.uk/).
|
42 |
\n\n\n
|
43 |
Developed by: [Mohammed H AlHaj](https://www.linkedin.com/in/m7mdal7aj)
|
@@ -45,21 +53,27 @@ class UIManager:
|
|
45 |
Dissertation Supervisor: [Andreas Theophilou](https://researchportal.bath.ac.uk/en/persons/andreas-theophilou)
|
46 |
Further details will be updated later""")
|
47 |
|
|
|
48 |
def display_dataset_analysis(self):
|
49 |
"""Displays the Dataset Analysis page."""
|
|
|
50 |
st.title("OK-VQA Dataset Analysis")
|
51 |
st.write("This is a Place Holder until the contents are uploaded.")
|
52 |
|
|
|
53 |
def display_finetuning_evaluation(self):
|
54 |
"""Displays the Finetuning and Evaluation Results page."""
|
55 |
st.title("Finetuning and Evaluation Results")
|
56 |
st.write("This is a Place Holder until the contents are uploaded.")
|
57 |
|
|
|
58 |
def display_run_inference(self):
|
59 |
"""Displays the Run Inference page."""
|
|
|
60 |
inference_runner = InferenceRunner()
|
61 |
inference_runner.run_inference()
|
62 |
|
|
|
63 |
def display_dissertation_report(self):
|
64 |
"""Displays the Dissertation Report page."""
|
65 |
st.title("Dissertation Report")
|
@@ -72,14 +86,17 @@ class UIManager:
|
|
72 |
mime="application/octet-stream"
|
73 |
)
|
74 |
|
|
|
75 |
def display_code(self):
|
76 |
"""Displays the Code page with a link to the project's code repository."""
|
|
|
77 |
st.title("Code")
|
78 |
-
st.markdown("You can view the code for this project on
|
79 |
-
# Inform users they are leaving the app
|
80 |
st.markdown("[View Code](https://huggingface.co/spaces/m7mdal7aj/Mohammed_Alhaj_PlayGround/tree/main)", unsafe_allow_html=True)
|
81 |
|
|
|
82 |
def display_placeholder(self):
|
83 |
"""Displays a placeholder for future content."""
|
|
|
84 |
st.title("Stay Tuned")
|
85 |
st.write("This is a Place Holder until the contents are uploaded.")
|
|
|
18 |
"More Pages will follow .. ": self.display_placeholder
|
19 |
}
|
20 |
|
21 |
+
|
22 |
def add_tab(self, tab_name, display_function):
|
23 |
"""Adds a new tab to the UI."""
|
24 |
self.tabs[tab_name] = display_function
|
25 |
|
26 |
+
|
27 |
def display_sidebar(self):
|
28 |
"""Displays the sidebar for navigation."""
|
29 |
+
|
30 |
st.sidebar.title("Navigation")
|
31 |
selection = st.sidebar.radio("Go to", list(self.tabs.keys()))
|
32 |
return selection
|
33 |
+
|
34 |
|
35 |
def display_selected_page(self, selection):
|
36 |
"""Displays the selected page based on user's choice."""
|
37 |
+
|
38 |
if selection in self.tabs:
|
39 |
self.tabs[selection]()
|
40 |
|
41 |
+
|
42 |
def display_home(self):
|
43 |
"""Displays the Home page of the application."""
|
44 |
+
|
45 |
st.markdown("<h1 style='text-align: center;'>MultiModal Learning for Visual Question Answering using World Knowledge</h1>", unsafe_allow_html=True)
|
46 |
st.write(" ")
|
47 |
st.markdown("<h2 style='text-align: center;'>(Knowledge-Based Visual Question Answering)</h2>", unsafe_allow_html=True)
|
48 |
+
|
49 |
st.write("""\n\nThis application is an interactive element of the project as part of the dissertation for Masters degree in Artificial Intelligence at the [University of Bath](https://www.bath.ac.uk/).
|
50 |
\n\n\n
|
51 |
Developed by: [Mohammed H AlHaj](https://www.linkedin.com/in/m7mdal7aj)
|
|
|
53 |
Dissertation Supervisor: [Andreas Theophilou](https://researchportal.bath.ac.uk/en/persons/andreas-theophilou)
|
54 |
Further details will be updated later""")
|
55 |
|
56 |
+
|
57 |
def display_dataset_analysis(self):
|
58 |
"""Displays the Dataset Analysis page."""
|
59 |
+
|
60 |
st.title("OK-VQA Dataset Analysis")
|
61 |
st.write("This is a Place Holder until the contents are uploaded.")
|
62 |
|
63 |
+
|
64 |
def display_finetuning_evaluation(self):
|
65 |
"""Displays the Finetuning and Evaluation Results page."""
|
66 |
st.title("Finetuning and Evaluation Results")
|
67 |
st.write("This is a Place Holder until the contents are uploaded.")
|
68 |
|
69 |
+
|
70 |
def display_run_inference(self):
|
71 |
"""Displays the Run Inference page."""
|
72 |
+
|
73 |
inference_runner = InferenceRunner()
|
74 |
inference_runner.run_inference()
|
75 |
|
76 |
+
|
77 |
def display_dissertation_report(self):
|
78 |
"""Displays the Dissertation Report page."""
|
79 |
st.title("Dissertation Report")
|
|
|
86 |
mime="application/octet-stream"
|
87 |
)
|
88 |
|
89 |
+
|
90 |
def display_code(self):
|
91 |
"""Displays the Code page with a link to the project's code repository."""
|
92 |
+
|
93 |
st.title("Code")
|
94 |
+
st.markdown("You can view the code for this project on HuggingFace Space files page.")
|
|
|
95 |
st.markdown("[View Code](https://huggingface.co/spaces/m7mdal7aj/Mohammed_Alhaj_PlayGround/tree/main)", unsafe_allow_html=True)
|
96 |
|
97 |
+
|
98 |
def display_placeholder(self):
|
99 |
"""Displays a placeholder for future content."""
|
100 |
+
|
101 |
st.title("Stay Tuned")
|
102 |
st.write("This is a Place Holder until the contents are uploaded.")
|