louiecerv commited on
Commit
fdbdee7
·
1 Parent(s): 3971b6f

sync with remote

Browse files
Files changed (3) hide show
  1. README.md +2 -2
  2. app.py +338 -0
  3. requirements.txt +3 -0
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: Vqa Supervised Machine Learning
3
  emoji: 💻
4
  colorFrom: purple
5
- colorTo: purple
6
  sdk: streamlit
7
  sdk_version: 1.42.0
8
  app_file: app.py
 
1
  ---
2
+ title: VQA on Supervised Machine Learning
3
  emoji: 💻
4
  colorFrom: purple
5
+ colorTo: red
6
  sdk: streamlit
7
  sdk_version: 1.42.0
8
  app_file: app.py
app.py ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+ import google.generativeai as genai
4
+ from huggingface_hub import hf_hub_download
5
+ import base64
6
+
7
+ MODEL_ID = "gemini-2.0-flash-exp" # Keep the model ID as is
8
+ try:
9
+ api_key = os.getenv("GEMINI_API_KEY")
10
+ model_id = MODEL_ID
11
+ genai.configure(api_key=api_key)
12
+ except Exception as e:
13
+ st.error(f"Error: {e}")
14
+ st.stop
15
+
16
+ model = genai.GenerativeModel(MODEL_ID)
17
+ chat = model.start_chat()
18
+
19
+ def download_pdf():
20
+ """
21
+ Downloads the PDF file from the Hugging Face Hub using the correct repo path and filename.
22
+ """
23
+ try:
24
+ hf_token = os.getenv("HF_TOKEN")
25
+ repo_id = "louiecerv/vqa_machine_learning_dataset" # Corrected dataset repo path
26
+ filename = "Supervised_Learning_Alogirthms.pdf"
27
+ filepath = hf_hub_download(repo_id=repo_id, filename=filename, token=hf_token, repo_type="dataset")
28
+ return filepath
29
+ except Exception as e:
30
+ st.error(f"Failed to download PDF from Hugging Face Hub: {e}")
31
+ st.stop() # Stop if the download fails
32
+
33
+ # Initialize conversation history in Streamlit session state
34
+ if "conversation_history" not in st.session_state:
35
+ st.session_state.conversation_history = []
36
+ if "uploaded_file_part" not in st.session_state: # Store the file *part*
37
+ st.session_state.uploaded_file_part = None
38
+ if "uploaded_pdf_path" not in st.session_state:
39
+ st.session_state.uploaded_pdf_path = download_pdf()
40
+
41
+ def multimodal_prompt(pdf_path, text_prompt):
42
+ """
43
+ Sends a multimodal prompt to Gemini, handling file uploads efficiently.
44
+ Args:
45
+ pdf_path: The path to the PDF file.
46
+ text_prompt: The text prompt for the model.
47
+ Returns:
48
+ The model's response as a string, or an error message.
49
+ """
50
+ try:
51
+ if st.session_state.uploaded_file_part is None: # First time, upload
52
+ pdf_part = genai.upload_file(pdf_path, mime_type="application/pdf")
53
+ st.session_state.uploaded_file_part = pdf_part
54
+ prompt = [text_prompt, pdf_part] # First turn includes the actual file
55
+ else: # Subsequent turns, reference the file
56
+
57
+ prompt = [text_prompt, st.session_state.uploaded_file_part] # Subsequent turns include the file reference
58
+
59
+ response = chat.send_message(prompt)
60
+
61
+ # Update conversation history
62
+ st.session_state.conversation_history.append({"role": "user", "content": text_prompt, "has_pdf": True})
63
+ st.session_state.conversation_history.append({"role": "assistant", "content": response.text})
64
+ return response.text
65
+
66
+ except Exception as e:
67
+ return f"An error occurred: {e}"
68
+
69
+ def display_download_button(file_path, file_name):
70
+ try:
71
+ with open(file_path, "rb") as f:
72
+ file_bytes = f.read()
73
+ b64 = base64.b64encode(file_bytes).decode()
74
+ href = f'<a href="data:application/pdf;base64,{b64}" download="{file_name}">Download the source document (PDF)</a>'
75
+ st.markdown(href, unsafe_allow_html=True)
76
+ except FileNotFoundError:
77
+ st.error("File not found for download.")
78
+ except Exception as e:
79
+ st.error(f"Error during download: {e}")
80
+
81
+ # Define the ML Models
82
+ roles = ["Linear Regression", "Logistic Regression",
83
+ "Naive Bayes", "Support Vector Machine", "Decision Tree",
84
+ "Random Forest", "K-Nearest Neighbor", "Gradient Boosting Manchines", "Neural Network"]
85
+
86
+ # --- Sidebar ---
87
+ st.sidebar.title("🤖 Visual Q and A")
88
+ selected_model = st.sidebar.selectbox("Select the ML Model", roles)
89
+
90
+ # --- Main Page ---
91
+ st.title("📚 VQA on the Supervised Machine Learning Algorithms")
92
+ about = """
93
+
94
+ **How to use this App**
95
+ This app leverages Gemini 2.0 to provide insights on the provided document.
96
+ Select a question from the dropdown menu or enter your own question to get
97
+ Gemini's generated response based on the provided document.
98
+ """
99
+
100
+ with st.expander("How to use this App"):
101
+ st.markdown(about)
102
+
103
+ # --- Q and A Tab ---
104
+ st.header("Questions and Answers")
105
+
106
+ # Generate 5 questions based on the selected model
107
+ if selected_model == "Linear Regression":
108
+ questions = [
109
+ "What is the fundamental concept of Linear Regression and how does it connect to the goal of predicting a target variable?",
110
+ "Explain the different components of the Linear Regression equation: y, x1, x2,..., xn, β0, β1, β2,..., βn, and e.",
111
+ "How does the Ordinary Least Squares (OLS) method help in finding the best-fit line in Linear Regression?",
112
+ "What is the role of the error term (e) in Linear Regression and how does it affect the accuracy of predictions?",
113
+ "What are the primary advantages of using Linear Regression, especially in terms of simplicity and efficiency?",
114
+ "In what situations would the assumption of a linear relationship in Linear Regression become a major drawback?",
115
+ "How do outliers impact a Linear Regression model and what methods can be used to reduce their influence?",
116
+ "Explain the concept of multicollinearity in the context of Linear Regression and its potential effects on model performance.",
117
+ "Can you provide real-world examples where Linear Regression is a suitable and effective solution?",
118
+ "How can Linear Regression be used to predict a continuous value, such as the price of a house or stock?",
119
+ "What are the limitations of Linear Regression when dealing with non-linear or categorical data?",
120
+ "How does Linear Regression differ from Logistic Regression, especially in terms of the types of problems they address?",
121
+ "What are the relative strengths and weaknesses of Linear Regression compared to more complex models like Support Vector Machines (SVM) or Decision Trees?",
122
+ "How can Linear Regression be adapted or modified to handle non-linear relationships between variables?",
123
+ "What techniques can be used for feature selection or dimensionality reduction to enhance the performance of Linear Regression?",
124
+ "How can regularization methods like Ridge or Lasso regression prevent overfitting in Linear Regression models?",
125
+ "What are the consequences of heteroscedasticity in Linear Regression and how can it be dealt with?",
126
+ "What metrics are commonly used to evaluate the performance of a Linear Regression model, such as R-squared or mean squared error?",
127
+ "How can the coefficients (β1, β2,..., βn) in a Linear Regression model be interpreted to understand the effect of each independent variable on the target variable?",
128
+ "Can you explain the limitations of Linear Regression when dealing with high-dimensional data or datasets with a large number of features?"
129
+ ]
130
+ if selected_model == "Logistic Regression":
131
+ questions =[
132
+ "What is the fundamental concept of Logistic Regression and how does it apply to binary classification problems?",
133
+ "Explain the role of the sigmoid function in Logistic Regression and how it helps predict probabilities.",
134
+ "How does Logistic Regression determine the threshold for classifying an instance into one of the two classes?",
135
+ "What are the main advantages of using Logistic Regression, particularly its interpretability and ability to provide probability estimates?",
136
+ "In what situations would the inability of Logistic Regression to handle non-linear relationships effectively become a significant limitation?",
137
+ "How does Logistic Regression handle irrelevant features in the dataset and how does it affect the model's performance?",
138
+ "Can you provide real-world examples where Logistic Regression is commonly used for classification tasks?",
139
+ "How does Logistic Regression compare to Linear Regression in terms of their applications and the types of problems they address?",
140
+ "What are the limitations of Logistic Regression when dealing with multi-class classification problems?",
141
+ "How can Logistic Regression be extended or modified to handle non-linear decision boundaries?",
142
+ "What techniques can be used to address overfitting in Logistic Regression models?",
143
+ "What metrics are commonly used to evaluate the performance of a Logistic Regression model, such as accuracy, precision, recall, and F1-score?",
144
+ "How can the coefficients in a Logistic Regression model be interpreted to understand the influence of each independent variable on the predicted probabilities?",
145
+ "What are the implications of imbalanced datasets in Logistic Regression and how can they be addressed?",
146
+ "How does Logistic Regression handle categorical features and how are they incorporated into the model?",
147
+ "What are the advantages and disadvantages of using Logistic Regression compared to other classification models like Support Vector Machines or Decision Trees?",
148
+ "How can regularization techniques be applied in Logistic Regression to improve model generalization?",
149
+ "What are the challenges in interpreting the results of Logistic Regression when dealing with high-dimensional data?",
150
+ "How can Logistic Regression be used in applications like spam detection, fraud detection, or medical diagnosis?",
151
+ "What are the ethical considerations when using Logistic Regression in sensitive domains like healthcare or criminal justice?"
152
+ ]
153
+ if selected_model == "Naive Bayes":
154
+ questions = [
155
+ "Explain the underlying principle of Naïve Bayes and its connection to Bayes' Theorem.",
156
+ "What is the assumption of independence among predictors in Naïve Bayes, and how does it affect the model's performance?",
157
+ "Describe how Naïve Bayes calculates the probability of a class C given features X, using the formula and explaining each term.",
158
+ "What are the key advantages of using Naïve Bayes, such as speed, scalability, and robustness to irrelevant features?",
159
+ "In what situations would the assumption of feature independence in Naïve Bayes become a significant limitation?",
160
+ "How does Naïve Bayes handle continuous features and incorporate them into the model?",
161
+ "Provide real-world examples where Naïve Bayes is commonly used for classification tasks.",
162
+ "Compare Naïve Bayes to other classification models like Logistic Regression or Support Vector Machines, considering accuracy and efficiency.",
163
+ "What are the different variations of Naïve Bayes, like Gaussian Naïve Bayes or Multinomial Naïve Bayes, and how do their applications differ?",
164
+ "Explain how Naïve Bayes can be used in text classification, spam filtering, or sentiment analysis.",
165
+ "What techniques can improve the performance of Naïve Bayes when dealing with correlated features?",
166
+ "How does Naïve Bayes handle missing values in the dataset?",
167
+ "What are the limitations of Naïve Bayes when dealing with high-dimensional data or datasets with many features?",
168
+ "How can Naïve Bayes be combined with other machine learning techniques, such as ensemble methods?",
169
+ "What ethical considerations arise when using Naïve Bayes in sensitive areas like healthcare or finance?",
170
+ "How does Naïve Bayes handle imbalanced datasets, and how can this issue be addressed?",
171
+ "What challenges are associated with interpreting the results of Naïve Bayes, especially with many features?",
172
+ "How can Naïve Bayes be used in real-time applications that require quick predictions?",
173
+ "Compare the advantages and disadvantages of using Naïve Bayes versus deep learning models for classification tasks.",
174
+ "How can Naïve Bayes be adapted or modified to handle both continuous and categorical features together?"
175
+ ]
176
+ if selected_model == "Support Vector Machine":
177
+ questions = [
178
+ "What is the core concept behind Support Vector Machines (SVM) and how does it relate to finding the optimal hyperplane for classification?",
179
+ "Explain the concept of a margin in SVM and its importance in achieving good generalization performance.",
180
+ "How does SVM handle non-linearly separable data using the Kernel Trick?",
181
+ "What are the different types of kernel functions used in SVM, such as linear, polynomial, and radial basis function (RBF) kernels?",
182
+ "What are the main advantages of using SVM, particularly its effectiveness in high-dimensional spaces and ability to handle non-linear classification?",
183
+ "What are the limitations of SVM, such as its computational cost for large datasets and difficulty in tuning hyperparameters?",
184
+ "How does SVM compare to other classification models like Logistic Regression or Decision Trees in terms of accuracy and complexity?",
185
+ "How can SVM be used for both classification and regression tasks?",
186
+ "What are the challenges in choosing the appropriate kernel function for an SVM model?",
187
+ "How does SVM handle outliers in the dataset and how do they affect the model's performance?",
188
+ "What are the different optimization algorithms used to train SVM models, such as quadratic programming or gradient descent?",
189
+ "How can SVM be used in applications like image recognition, text classification, or bioinformatics?",
190
+ "What are the implications of imbalanced datasets in SVM and how can they be addressed?",
191
+ "How does SVM handle categorical features and how are they incorporated into the model?",
192
+ "What are the advantages and disadvantages of using SVM compared to deep learning models for classification tasks?",
193
+ "How can SVM be used in conjunction with other machine learning techniques, such as ensemble methods or feature selection?",
194
+ "What are the ethical considerations when using SVM in sensitive domains like healthcare or finance?",
195
+ "How can SVM be adapted or modified to handle online learning scenarios where data arrives sequentially?",
196
+ "What are the challenges in interpreting the results of SVM, particularly when using non-linear kernel functions?",
197
+ "How can SVM be used in real-time applications where quick predictions are required?"
198
+ ]
199
+ if selected_model == "Decision Tree":
200
+ questions = [
201
+ "What is the fundamental concept of a Decision Tree and how does it use a tree-like structure for classification or regression?",
202
+ "Explain the process of constructing a Decision Tree, including how the data is recursively split based on features.",
203
+ "What are the different splitting criteria used in Decision Trees, such as information gain, Gini impurity, or entropy?",
204
+ "What are the advantages of using Decision Trees, such as their interpretability and ability to handle both numerical and categorical data?",
205
+ "What are the disadvantages of Decision Trees, such as their tendency to overfit the training data?",
206
+ "How can overfitting be prevented in Decision Trees using techniques like pruning or setting limits on the tree depth?",
207
+ "How can Decision Trees be used for both classification and regression tasks?",
208
+ "How do you interpret the results of a Decision Tree and understand the decision rules it has learned?",
209
+ "What are the limitations of Decision Trees when dealing with complex relationships or high-dimensional data?",
210
+ "How does a Decision Tree compare to other models like Linear Regression or Support Vector Machines in terms of interpretability and accuracy?",
211
+ "What are the different ensemble methods that utilize Decision Trees, such as Random Forest or Gradient Boosting Machines?",
212
+ "How can Decision Trees be used in applications like customer churn prediction, medical diagnosis, or fraud detection?",
213
+ "How can Decision Trees handle missing values in the dataset?",
214
+ "What are the ethical considerations when using Decision Trees in sensitive domains like healthcare or education?",
215
+ "How can Decision Trees be used in conjunction with other machine learning techniques, such as feature selection or data visualization?",
216
+ "What are the challenges in interpreting the results of Decision Trees when dealing with a large number of features or complex branching structures?",
217
+ "How can Decision Trees be adapted or modified to handle imbalanced datasets?",
218
+ "What are the advantages and disadvantages of using Decision Trees compared to deep learning models for classification or regression tasks?",
219
+ "How can Decision Trees be used in real-time applications where quick predictions are required?",
220
+ "How can Decision Trees be used to identify important features or variables that contribute most to the prediction task?"
221
+ ]
222
+ if selected_model == "Random Forest":
223
+ questions = [
224
+ "What is the fundamental concept of a Random Forest and how does it differ from a single Decision Tree?",
225
+ "Explain the process of constructing a Random Forest, including the steps involved in creating multiple Decision Trees and combining their predictions.",
226
+ "How does the Random Forest algorithm utilize bagging (bootstrap aggregating) to enhance the diversity and robustness of the model?",
227
+ "What are the key parameters that influence the performance of a Random Forest, such as the number of trees, tree depth, and number of features considered at each split?",
228
+ "How does Random Forest achieve better generalization performance and reduce overfitting compared to a single Decision Tree?",
229
+ "Explain the role of feature randomness in Random Forest and how it helps to decorrelate the trees and improve model accuracy.",
230
+ "What are the main advantages of using Random Forest, such as its ability to handle high-dimensional data, missing values, and irrelevant features?",
231
+ "What are the limitations of Random Forest, such as its computational cost and potential lack of interpretability compared to a single Decision Tree?",
232
+ "How does Random Forest compare to other ensemble methods like Gradient Boosting Machines in terms of accuracy, complexity, and interpretability?",
233
+ "How can Random Forest be used for both classification and regression tasks, and what are the differences in its implementation for each type of problem?",
234
+ "How do you interpret the results of a Random Forest, including understanding feature importance and visualizing the decision boundaries?",
235
+ "What metrics are commonly used to evaluate the performance of a Random Forest model, such as accuracy, precision, recall, F1-score, and AUC?",
236
+ "How can Random Forest be used in real-world applications, such as image classification, object detection, fraud detection, and bioinformatics?",
237
+ "How does Random Forest handle imbalanced datasets and what techniques can be used to address this issue?",
238
+ "What are the ethical considerations when using Random Forest in sensitive domains, such as healthcare or finance?",
239
+ "How can Random Forest be integrated with other machine learning techniques, such as feature selection, dimensionality reduction, or hyperparameter optimization?",
240
+ "What are the challenges in deploying and maintaining a Random Forest model in a production environment, particularly in terms of scalability and resource utilization?",
241
+ "How can Random Forest be adapted or modified to handle online learning scenarios where data arrives sequentially?",
242
+ "What are the ongoing research directions and advancements in the field of Random Forest, such as exploring new tree diversity techniques or incorporating explainability features?",
243
+ "What are the advantages and disadvantages of using Random Forest compared to deep learning models for various machine learning tasks?"
244
+ ]
245
+ if selected_model == "K-Nearest Neighbor":
246
+ questions = [
247
+ "What is the core concept behind the K-Nearest Neighbors (KNN) algorithm and how does it use similarity metrics for classification or regression?",
248
+ "Explain the process of classifying a new instance using KNN, including how the algorithm calculates distances to the K nearest neighbors.",
249
+ "What are the different distance metrics used in KNN, such as Euclidean distance, Manhattan distance, or cosine similarity?",
250
+ "How does the choice of K value affect the model's performance and generalization ability in KNN?",
251
+ "What are the main advantages of using KNN, such as its simplicity, flexibility, and ability to handle non-linear decision boundaries?",
252
+ "What are the limitations of KNN, such as its computational cost for large datasets, sensitivity to irrelevant features, and lack of interpretability?",
253
+ "How does KNN compare to other classification models like Logistic Regression or Support Vector Machines in terms of accuracy and efficiency?",
254
+ "How can KNN be used for both classification and regression tasks, and what are the differences in its implementation for each type of problem?",
255
+ "What are the challenges in choosing an appropriate distance metric for KNN, especially when dealing with high-dimensional data or mixed data types?",
256
+ "How does KNN handle categorical features and how are they incorporated into the model?",
257
+ "What are the different strategies for handling missing values in the dataset when using KNN?",
258
+ "How can KNN be used in applications like recommendation systems, anomaly detection, or clustering?",
259
+ "What are the implications of imbalanced datasets in KNN and how can they be addressed?",
260
+ "What are the ethical considerations when using KNN in sensitive domains like healthcare or finance?",
261
+ "How can KNN be integrated with other machine learning techniques, such as feature selection, dimensionality reduction, or ensemble methods?",
262
+ "What are the challenges in interpreting the results of KNN, particularly when dealing with a large number of features or instances?",
263
+ "How can KNN be adapted or modified to handle online learning scenarios where data arrives sequentially?",
264
+ "What are the advantages and disadvantages of using KNN compared to deep learning models for classification or regression tasks?",
265
+ "How can KNN be used in real-time applications where quick predictions are required?",
266
+ "What are the ongoing research directions and advancements in the field of KNN, such as exploring new distance metrics or improving the algorithm's scalability and efficiency?"
267
+ ]
268
+ if selected_model == "Gradient Boosting Manchines":
269
+ questions = [
270
+ "What is the core concept behind Gradient Boosting Machines (GBM) and how does it use an ensemble of weak learners to create a strong predictive model?",
271
+ "Explain the process of training a Gradient Boosting Machine, including how the algorithm sequentially adds trees to correct errors made by the previous trees.",
272
+ "How does GBM handle the issue of overfitting by using techniques like shrinkage (learning rate) and tree pruning?",
273
+ "What are the different loss functions used in GBM, such as mean squared error, log loss, or hinge loss, and how do they affect the model's performance?",
274
+ "What are the main advantages of using GBM, such as its high predictive accuracy, robustness to outliers, and ability to capture complex relationships in the data?",
275
+ "What are the limitations of GBM, such as its computational cost, sensitivity to hyperparameters, and potential overfitting on noisy data?",
276
+ "How does GBM compare to other ensemble methods like Random Forest or AdaBoost in terms of accuracy, complexity, and interpretability?",
277
+ "How can GBM be used for both classification and regression tasks, and what are the differences in its implementation for each type of problem?",
278
+ "What are the challenges in tuning hyperparameters for GBM, such as the number of trees, tree depth, learning rate, and subsampling rate?",
279
+ "How does GBM handle missing values in the dataset and what techniques can be used to impute or ignore them during training?",
280
+ "What are the different feature importance metrics used in GBM, such as gain, cover, or frequency, and how do they help interpret the model's predictions?",
281
+ "What are the different regularization techniques that can be applied to GBM, such as L1 or L2 regularization, to prevent overfitting?",
282
+ "How can GBM be used in real-world applications like click-through rate prediction, customer churn analysis, or fraud detection?",
283
+ "What are the implications of imbalanced datasets in GBM and how can they be addressed using techniques like class weights or resampling?",
284
+ "What are the ethical considerations when using GBM in sensitive domains like healthcare or finance?",
285
+ "How can GBM be integrated with other machine learning techniques, such as feature selection, dimensionality reduction, or hyperparameter optimization?",
286
+ "What are the challenges in interpreting the results of GBM, particularly when dealing with a large number of features or complex interactions?",
287
+ "How can GBM be adapted or modified to handle online learning scenarios where data arrives sequentially?",
288
+ "What are the ongoing research directions and advancements in the field of GBM, such as exploring new loss functions or improving the algorithm's scalability and efficiency?",
289
+ "What are the advantages and disadvantages of using GBM compared to deep learning models for various machine learning tasks?"
290
+ ]
291
+ if selected_model == "Neural Network":
292
+ questions = [
293
+ "What is the core concept behind Neural Networks and how do they mimic the structure and function of the human brain?",
294
+ "Explain the architecture of a basic feedforward Neural Network, including input layer, hidden layers, activation functions, and output layer.",
295
+ "How does a Neural Network learn from data using techniques like backpropagation, gradient descent, and stochastic gradient descent?",
296
+ "What are the different types of Neural Networks, such as Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), or Generative Adversarial Networks (GANs)?",
297
+ "What are the main advantages of using Neural Networks, such as their ability to learn complex patterns, generalize well to new data, and adapt to different tasks?",
298
+ "What are the limitations of Neural Networks, such as their computational cost, sensitivity to hyperparameters, and potential overfitting on small datasets?",
299
+ "How does a Neural Network compare to other machine learning models like Support Vector Machines or Decision Trees in terms of accuracy, complexity, and interpretability?",
300
+ "How can Neural Networks be used for both classification and regression tasks, and what are the differences in their implementation for each type of problem?",
301
+ "What are the challenges in designing the architecture of a Neural Network, such as choosing the number of layers, neurons per layer, and activation functions?",
302
+ "How does a Neural Network handle categorical features and how are they encoded into the model?",
303
+ "What are the different activation functions used in Neural Networks, such as sigmoid, tanh, ReLU, or softmax, and how do they affect the model's performance?",
304
+ "What are the different regularization techniques that can be applied to Neural Networks, such as dropout, weight decay, or early stopping, to prevent overfitting?",
305
+ "How can Neural Networks be used in real-world applications like image recognition, natural language processing, or reinforcement learning?",
306
+ "What are the implications of imbalanced datasets in Neural Networks and how can they be addressed using techniques like class weights or oversampling?",
307
+ "What are the ethical considerations when using Neural Networks in sensitive domains like healthcare or finance?",
308
+ "How can Neural Networks be integrated with other machine learning techniques, such as transfer learning, feature extraction, or hyperparameter optimization?",
309
+ "What are the challenges in interpreting the results of Neural Networks, particularly when dealing with deep architectures or complex data transformations?",
310
+ "How can Neural Networks be adapted or modified to handle online learning scenarios where data arrives sequentially?",
311
+ "What are the ongoing research directions and advancements in the field of Neural Networks, such as exploring new architectures, optimization algorithms, or explainability features?",
312
+ "What are the advantages and disadvantages of using Neural Networks compared to traditional machine learning models for various tasks?"
313
+ ]
314
+
315
+ # Create a selection box
316
+ selected_question = st.selectbox("Choose a question", questions)
317
+
318
+ # Display a checkbox
319
+ if st.checkbox('Check this box to ask a question not listed above'):
320
+ # If the checkbox is checked, display a text box
321
+ selected_question = st.text_input('Enter a question')
322
+
323
+ if st.button("Ask AI"):
324
+ with st.spinner("AI is thinking..."):
325
+ if st.session_state.uploaded_pdf_path is None:
326
+ st.session_state.uploaded_pdf_path = download_pdf()
327
+
328
+ filepath = st.session_state.uploaded_pdf_path
329
+ text_prompt = f"Use the provided document focus on rhe topic: {selected_model} to answer the following question: {selected_question}. Use your own knowledge as well as sources from the web and the provided document. Always cite your sourcss."
330
+ response = multimodal_prompt(filepath, text_prompt) # Use the downloaded filepath
331
+ st.markdown(f"**Question:** {selected_question}")
332
+ st.markdown(f"**Response:** {response}")
333
+
334
+ if st.session_state.uploaded_pdf_path:
335
+ display_download_button(st.session_state.uploaded_pdf_path, "Supervised_Learning_Alogirthms.pdf")
336
+
337
+ st.markdown("[Visit our Hugging Face Space!](https://huggingface.co/wvsuaidev)")
338
+ st.markdown("© 2025 WVSU AI Dev Team 🤖 ✨")
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ huggingface_hub
3
+ google-generativeai