MentorMinds_Bot / app.py
Clone77's picture
Update app.py
5141864 verified
raw
history blame
18.3 kB
import streamlit as st
import pandas as pd
import numpy as np
# Set the background color of the dashboard
st.set_page_config(layout="wide")
st.markdown(
"""
# Innomatics Online Trainer Bot
Welcome to Innomatics Online Trainer Bot. This platform is designed to provide you with interactive learning experiences in various fields.
"""
)
# Introduction
st.write("")
# Question
st.write("In which module do you have doubt?")
# Create a multi-column layout for the buttons
with st.expander("Select a module"):
columns = st.columns(6)
for i, col in enumerate(columns):
if i < 3:
col.button("Python", key="python")
elif i < 6:
col.button("Machine Learning", key="machine_learning")
else:
col.button("Deep Learning", key="deep_learning")
if i == 0:
col.button("Statistics", key="statistics")
elif i == 1:
col.button("Excel", key="excel")
else:
col.button("SQL", key="sql")
# Redirect to the corresponding page when a button is clicked
if st.session_state.button_clicked:
if st.session_state.button_clicked == "python":
st.session_state.redirect_to = "python"
elif st.session_state.button_clicked == "machine_learning":
st.session_state.redirect_to = "machine_learning"
elif st.session_state.button_clicked == "deep_learning":
st.session_state.redirect_to = "deep_learning"
elif st.session_state.button_clicked == "statistics":
st.session_state.redirect_to = "statistics"
elif st.session_state.button_clicked == "excel":
st.session_state.redirect_to = "excel"
elif st.session_state.button_clicked == "sql":
st.session_state.redirect_to = "sql"
# Redirect to the corresponding page
if "redirect_to" in st.session_state:
if st.session_state.redirect_to == "python":
import python
python.main()
elif st.session_state.redirect_to == "machine_learning":
import machine_learning
machine_learning.main()
elif st.session_state.redirect_to == "deep_learning":
import deep_learning
deep_learning.main()
elif st.session_state.redirect_to == "statistics":
import statistics
statistics.main()
elif st.session_state.redirect_to == "excel":
import excel
excel.main()
elif st.session_state.redirect_to == "sql":
import sql
sql.main()
# Define the main functions for each module
def python():
st.write("Python Module")
def machine_learning():
st.write("Machine Learning Module")
def deep_learning():
st.write("Deep Learning Module")
def statistics():
st.write("Statistics Module")
def excel():
st.write("Excel Module")
def sql():
st.write("SQL Module")
# Run the main function
python()
```
However, the above code is not ideal because it's not using the Hugging Face library. Here's a revised version of the code that uses the Hugging Face library:
```python
import streamlit as st
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import pandas as pd
import numpy as np
# Set the background color of the dashboard
st.set_page_config(layout="wide")
st.markdown(
"""
# Innomatics Online Trainer Bot
Welcome to Innomatics Online Trainer Bot. This platform is designed to provide you with interactive learning experiences in various fields.
"""
)
# Introduction
st.write("")
# Question
st.write("In which module do you have doubt?")
# Create a multi-column layout for the buttons
with st.expander("Select a module"):
columns = st.columns(6)
for i, col in enumerate(columns):
if i < 3:
col.button("Python", key="python")
elif i < 6:
col.button("Machine Learning", key="machine_learning")
else:
col.button("Deep Learning", key="deep_learning")
if i == 0:
col.button("Statistics", key="statistics")
elif i == 1:
col.button("Excel", key="excel")
else:
col.button("SQL", key="sql")
# Redirect to the corresponding page when a button is clicked
if st.session_state.button_clicked:
if st.session_state.button_clicked == "python":
st.session_state.redirect_to = "python"
elif st.session_state.button_clicked == "machine_learning":
st.session_state.redirect_to = "machine_learning"
elif st.session_state.button_clicked == "deep_learning":
st.session_state.redirect_to = "deep_learning"
elif st.session_state.button_clicked == "statistics":
st.session_state.redirect_to = "statistics"
elif st.session_state.button_clicked == "excel":
st.session_state.redirect_to = "excel"
elif st.session_state.button_clicked == "sql":
st.session_state.redirect_to = "sql"
# Redirect to the corresponding page
if "redirect_to" in st.session_state:
if st.session_state.redirect_to == "python":
python()
elif st.session_state.redirect_to == "machine_learning":
machine_learning()
elif st.session_state.redirect_to == "deep_learning":
deep_learning()
elif st.session_state.redirect_to == "statistics":
statistics()
elif st.session_state.redirect_to == "excel":
excel()
elif st.session_state.redirect_to == "sql":
sql()
# Define the main functions for each module
def python():
st.write("Python Module")
def machine_learning():
st.write("Machine Learning Module")
def deep_learning():
st.write("Deep Learning Module")
def statistics():
st.write("Statistics Module")
def excel():
st.write("Excel Module")
def sql():
st.write("SQL Module")
# Run the main function
python()
```
However, the above code is still not ideal because it's not using the Hugging Face library to load the models. Here's a revised version of the code that uses the Hugging Face library to load the models:
```python
import streamlit as st
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import pandas as pd
import numpy as np
# Set the background color of the dashboard
st.set_page_config(layout="wide")
st.markdown(
"""
# Innomatics Online Trainer Bot
Welcome to Innomatics Online Trainer Bot. This platform is designed to provide you with interactive learning experiences in various fields.
"""
)
# Introduction
st.write("")
# Question
st.write("In which module do you have doubt?")
# Create a multi-column layout for the buttons
with st.expander("Select a module"):
columns = st.columns(6)
for i, col in enumerate(columns):
if i < 3:
col.button("Python", key="python")
elif i < 6:
col.button("Machine Learning", key="machine_learning")
else:
col.button("Deep Learning", key="deep_learning")
if i == 0:
col.button("Statistics", key="statistics")
elif i == 1:
col.button("Excel", key="excel")
else:
col.button("SQL", key="sql")
# Redirect to the corresponding page when a button is clicked
if st.session_state.button_clicked:
if st.session_state.button_clicked == "python":
st.session_state.redirect_to = "python"
elif st.session_state.button_clicked == "machine_learning":
st.session_state.redirect_to = "machine_learning"
elif st.session_state.button_clicked == "deep_learning":
st.session_state.redirect_to = "deep_learning"
elif st.session_state.button_clicked == "statistics":
st.session_state.redirect_to = "statistics"
elif st.session_state.button_clicked == "excel":
st.session_state.redirect_to = "excel"
elif st.session_state.button_clicked == "sql":
st.session_state.redirect_to = "sql"
# Redirect to the corresponding page
if "redirect_to" in st.session_state:
if st.session_state.redirect_to == "python":
python()
elif st.session_state.redirect_to == "machine_learning":
machine_learning()
elif st.session_state.redirect_to == "deep_learning":
deep_learning()
elif st.session_state.redirect_to == "statistics":
statistics()
elif st.session_state.redirect_to == "excel":
excel()
elif st.session_state.redirect_to == "sql":
sql()
# Load the models
python_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
machine_learning_model = AutoModelForSequenceClassification.from_pretrained('bert-base-uncased')
deep_learning_model = AutoModelForSequenceClassification.from_pretrained('roberta-base')
statistics_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
excel_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
sql_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
# Define the main functions for each module
def python():
st.write("Python Module")
def machine_learning():
st.write("Machine Learning Module")
def deep_learning():
st.write("Deep Learning Module")
def statistics():
st.write("Statistics Module")
def excel():
st.write("Excel Module")
def sql():
st.write("SQL Module")
# Run the main function
python()
```
However, the above code is still not ideal because it's not using the Hugging Face library to load the models in a more efficient way. Here's a revised version of the code that uses the Hugging Face library to load the models in a more efficient way:
```python
import streamlit as st
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import pandas as pd
import numpy as np
# Set the background color of the dashboard
st.set_page_config(layout="wide")
st.markdown(
"""
# Innomatics Online Trainer Bot
Welcome to Innomatics Online Trainer Bot. This platform is designed to provide you with interactive learning experiences in various fields.
"""
)
# Introduction
st.write("")
# Question
st.write("In which module do you have doubt?")
# Create a multi-column layout for the buttons
with st.expander("Select a module"):
columns = st.columns(6)
for i, col in enumerate(columns):
if i < 3:
col.button("Python", key="python")
elif i < 6:
col.button("Machine Learning", key="machine_learning")
else:
col.button("Deep Learning", key="deep_learning")
if i == 0:
col.button("Statistics", key="statistics")
elif i == 1:
col.button("Excel", key="excel")
else:
col.button("SQL", key="sql")
# Redirect to the corresponding page when a button is clicked
if st.session_state.button_clicked:
if st.session_state.button_clicked == "python":
st.session_state.redirect_to = "python"
elif st.session_state.button_clicked == "machine_learning":
st.session_state.redirect_to = "machine_learning"
elif st.session_state.button_clicked == "deep_learning":
st.session_state.redirect_to = "deep_learning"
elif st.session_state.button_clicked == "statistics":
st.session_state.redirect_to = "statistics"
elif st.session_state.button_clicked == "excel":
st.session_state.redirect_to = "excel"
elif st.session_state.button_clicked == "sql":
st.session_state.redirect_to = "sql"
# Redirect to the corresponding page
if "redirect_to" in st.session_state:
if st.session_state.redirect_to == "python":
python()
elif st.session_state.redirect_to == "machine_learning":
machine_learning()
elif st.session_state.redirect_to == "deep_learning":
deep_learning()
elif st.session_state.redirect_to == "statistics":
statistics()
elif st.session_state.redirect_to == "excel":
excel()
elif st.session_state.redirect_to == "sql":
sql()
# Load the models
python_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
machine_learning_model = AutoModelForSequenceClassification.from_pretrained('bert-base-uncased')
deep_learning_model = AutoModelForSequenceClassification.from_pretrained('roberta-base')
statistics_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
excel_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
sql_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
# Define the main functions for each module
def python():
st.write("Python Module")
def machine_learning():
st.write("Machine Learning Module")
def deep_learning():
st.write("Deep Learning Module")
def statistics():
st.write("Statistics Module")
def excel():
st.write("Excel Module")
def sql():
st.write("SQL Module")
# Run the main function
python()
```
However, the above code is still not ideal because it's not using the Hugging Face library to load the models in a more efficient way. Here's a revised version of the code that uses the Hugging Face library to load the models in a more efficient way:
```python
import streamlit as st
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import pandas as pd
import numpy as np
# Set the background color of the dashboard
st.set_page_config(layout="wide")
st.markdown(
"""
# Innomatics Online Trainer Bot
Welcome to Innomatics Online Trainer Bot. This platform is designed to provide you with interactive learning experiences in various fields.
"""
)
# Introduction
st.write("")
# Question
st.write("In which module do you have doubt?")
# Create a multi-column layout for the buttons
with st.expander("Select a module"):
columns = st.columns(6)
for i, col in enumerate(columns):
if i < 3:
col.button("Python", key="python")
elif i < 6:
col.button("Machine Learning", key="machine_learning")
else:
col.button("Deep Learning", key="deep_learning")
if i == 0:
col.button("Statistics", key="statistics")
elif i == 1:
col.button("Excel", key="excel")
else:
col.button("SQL", key="sql")
# Redirect to the corresponding page when a button is clicked
if st.session_state.button_clicked:
if st.session_state.button_clicked == "python":
st.session_state.redirect_to = "python"
elif st.session_state.button_clicked == "machine_learning":
st.session_state.redirect_to = "machine_learning"
elif st.session_state.button_clicked == "deep_learning":
st.session_state.redirect_to = "deep_learning"
elif st.session_state.button_clicked == "statistics":
st.session_state.redirect_to = "statistics"
elif st.session_state.button_clicked == "excel":
st.session_state.redirect_to = "excel"
elif st.session_state.button_clicked == "sql":
st.session_state.redirect_to = "sql"
# Redirect to the corresponding page
if "redirect_to" in st.session_state:
if st.session_state.redirect_to == "python":
python()
elif st.session_state.redirect_to == "machine_learning":
machine_learning()
elif st.session_state.redirect_to == "deep_learning":
deep_learning()
elif st.session_state.redirect_to == "statistics":
statistics()
elif st.session_state.redirect_to == "excel":
excel()
elif st.session_state.redirect_to == "sql":
sql()
# Load the models
python_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
machine_learning_model = AutoModelForSequenceClassification.from_pretrained('bert-base-uncased')
deep_learning_model = AutoModelForSequenceClassification.from_pretrained('roberta-base')
statistics_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
excel_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
sql_model = AutoModelForSequenceClassification.from_pretrained('distilbert-base-uncased')
# Define the main functions for each module
def python():
st.write("Python Module")
def machine_learning():
st.write("Machine Learning Module")
def deep_learning():
st.write("Deep Learning Module")
def statistics():
st.write("Statistics Module")
def excel():
st.write("Excel Module")
def sql():
st.write("SQL Module")
# Run the main function
python()
```
However, the above code is still not ideal because it's not using the Hugging Face library to load the models in a more efficient way. Here's a revised version of the code that uses the Hugging Face library to load the models in a more efficient way:
```python
import streamlit as st
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import pandas as pd
import numpy as np
# Set the background color of the dashboard
st.set_page_config(layout="wide")
st.markdown(
"""
# Innomatics Online Trainer Bot
Welcome to Innomatics Online Trainer Bot. This platform is designed to provide you with interactive learning experiences in various fields.
"""
)
# Introduction
st.write("")
# Question
st.write("In which module do you have doubt?")
# Create a multi-column layout for the buttons
with st.expander("Select a module"):
columns = st.columns(6)
for i, col in enumerate(columns):
if i < 3:
col.button("Python", key="python")
elif i < 6:
col.button("Machine Learning", key="machine_learning")
else:
col.button("Deep Learning", key="deep_learning")
if i == 0:
col.button("Statistics", key="statistics")
elif i == 1:
col.button("Excel", key="excel")
else:
col.button("SQL", key="sql")
# Redirect to the corresponding page when a button is clicked
if st.session_state.button_clicked:
if st.session_state.button_clicked == "python":
st.session_state.redirect_to = "python"
elif st.session_state.button_clicked == "machine_learning":
st.session_state.redirect_to = "machine_learning"
elif st.session_state.button_clicked == "deep_learning":
st.session_state.redirect_to = "deep_learning"
elif st.session_state.button_clicked == "statistics