This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def download(df,filename): # Downloading DataFrame | |
csv = df.to_csv(index=False) | |
b64 = base64.b64encode(csv.encode()).decode() | |
href = (f'<a href="data:file/csv;base64,{b64}" download="%s.csv">Download csv file</a>' % (filename)) | |
return href | |
st.sidebar.subheader('Test Dataset') | |
status_test, df_test = file_upload('Please upload a test dataset') | |
if status_test == True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def confusion_matrix_plot(data): | |
z = data.tolist()[::-1] | |
x = ['Negative','Positive'] | |
y = ['Positive','Negative'] | |
z_text = z | |
fig = ff.create_annotated_heatmap(z, x, y, annotation_text=z_text, text=z,hoverinfo='text',colorscale='Blackbody') | |
fig.update_layout(font_family="IBM Plex Sans") | |
st.write(fig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
st.sidebar.subheader('Training Dataset') | |
status, df = file_upload('Please upload a training dataset') | |
if status == True: | |
col_names = list(df) | |
st.title('Training') | |
st.subheader('Parameters') | |
col1, col2, col3 = st.columns((3,3,2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def file_upload(name): | |
uploaded_file = st.sidebar.file_uploader('%s' % (name),key='%s' % (name),accept_multiple_files=False) | |
content = False | |
if uploaded_file is not None: | |
try: | |
uploaded_df = pd.read_csv(uploaded_file) | |
content = True | |
return content, uploaded_df | |
except: | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Combining images | |
images = [Image.open(x) for x in ['line_chart.png','bar_chart.png','histogram.png']] | |
widths, heights = zip(*(i.size for i in images)) | |
total_width = sum(widths) | |
max_height = max(heights) | |
combined_image = Image.new('RGBA', (total_width, max_height)) | |
offset = 0 | |
for im in images: | |
combined_image.paste(im, (offset,0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.read_excel('C:/Users/.../Desktop/Exam_results.xlsx') | |
exam_averages = [int(df['Exam 1'].mean()), int(df['Exam 2'].mean()), | |
int(df['Exam 3'].mean()), int(df['Exam 4'].mean())] | |
exams = ['Exam 1', 'Exam 2', 'Exam 3', 'Exam 4'] | |
for i in range(0,len(df)): | |
exam_results = [df.loc[i]['Exam 1'], df.loc[i]['Exam 2'], df.loc[i]['Exam 3'], df.loc[i]['Exam 4']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for email_id in data[0].split(): | |
_,data = mail.fetch(email_id, '(RFC822)' ) | |
raw_email = data[0][1] | |
raw_email = raw_email.decode('utf-8') | |
email_content = email.message_from_string(raw_email) | |
if 'Exam Results' in email_content['Subject']: #Change this line to the subject you are searching for | |
for part in email_content.walk(): | |
if part.get_content_maintype() == 'multipart': | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imaplib | |
import base64 | |
import os | |
import email | |
import pandas as pd | |
from plotly.subplots import make_subplots | |
import plotly.graph_objects as go | |
import plotly.express as px | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
# Initiating connection and setting motion profile | |
keyHandle = epos.VCS_OpenDevice(b'EPOS2', b'MAXON SERIAL V2', b'USB', b'USB0', byref(pErrorCode)) # specify EPOS version and interface | |
epos.VCS_SetProtocolStackSettings(keyHandle, baudrate, timeout, byref(pErrorCode)) # set baudrate | |
epos.VCS_ClearFault(keyHandle, nodeID, byref(pErrorCode)) # clear all faults | |
epos.VCS_ActivateProfilePositionMode(keyHandle, nodeID, byref(pErrorCode)) # activate profile position mode | |
epos.VCS_SetEnableState(keyHandle, nodeID, byref(pErrorCode)) # enable device | |
epos.VCS_SetPositionProfile(keyHandle, nodeID, 5000, 30000, 30000, byref(pErrorCode)) # set profile parameters | |
epos.VCS_MoveToPosition(keyHandle, nodeID, 100000, True, True, byref(pErrorCode)) # move to position | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import time | |
from ctypes import * | |
# EPOS Command Library path | |
path='.\EposCmd64.dll' | |
# Load library | |
cdll.LoadLibrary(path) | |
epos = CDLL(path) |
NewerOlder