Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,37 @@
|
|
1 |
import gradio as gr
|
2 |
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
#######################
|
5 |
-
#First
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
with gr.Blocks() as demo:
|
7 |
with gr.Tab("A - Visual Template Builder"):
|
8 |
gr.Markdown("On this tab you can input a purely visual template (assignment tables empty) and have it primed for use in the scheduling algorithm. The info generated here will also be sent as inputs to tab B. See the documentation for more details on required formatting")
|
@@ -27,13 +56,14 @@ with gr.Blocks() as demo:
|
|
27 |
with gr.Column():
|
28 |
with gr.Tab("Non-File Inputs"):
|
29 |
with gr.Row():
|
30 |
-
gr.Radio(["Yes", "No"],label="Assign OT to WWF? (If 'yes', WWF will be considered for filling in slots beyond their prescribed shifts in the Assignment List)")
|
31 |
-
gr.Radio(["Bud","Blue"],label="Which crew is on A shift this week?")
|
32 |
with gr.Row():
|
33 |
-
gr.Radio([32, 40],label="Regular Work Hours This Week?")
|
34 |
-
gr.CheckboxGroup(["Friday", "Monday"], label="Check the boxes as appropriate if scheduling long weekend")
|
35 |
B_bt_MS = gr.Button("Generate Schedule")
|
36 |
B_fl_FS=gr.File(label="Generated Schedule")
|
|
|
37 |
with gr.Tab("C - Review"):
|
38 |
gr.Markdown("On this tab you can observe the template used to make the last generated scheduled by entering '0' for number of assignments. Positive values will yield the schedule in progress, stopped after making that many assignments.")
|
39 |
with gr.Row():
|
@@ -43,7 +73,9 @@ with gr.Blocks() as demo:
|
|
43 |
with gr.Column():
|
44 |
C_fl_PS=gr.File(label="Partially Complete Schedule")
|
45 |
C_bt_PS = gr.Button("Partially Generate Schedule")
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
|
49 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from datetime import datetime
|
3 |
+
import SchedBuilderUtyModule as tls
|
4 |
+
import SchedBuilderClasses2 as cls
|
5 |
+
#Just in case:
|
6 |
+
import openpyxl as pyxl
|
7 |
+
import pandas as pd
|
8 |
+
import numpy as np
|
9 |
+
from copy import deepcopy
|
10 |
|
11 |
#######################
|
12 |
+
#First define the functions
|
13 |
+
def PrimeVisualTemplate(vTmplFl,FTrefFl,TempRefFl):
|
14 |
+
primedTemplateName=tls.translate_Visual_Template(vTmplFl,FTrefFl,TempRefFl)
|
15 |
+
return primedTemplateName,primedTemplateName,datetime.now(),datetime.now() #Return twice so as to send file to two interface entities (file holders), plus time stampers
|
16 |
+
|
17 |
+
def GenerateSchedule(schedWWF,xtraDays,wkHrs,DaysCrew,AssnFl,FTrefFl,TempRefFl,PollFl):
|
18 |
+
assnWWF=schedWWF
|
19 |
+
if assnWWF=='Yes': assnWWF=True
|
20 |
+
if assnWWF=='No': assnWWF=True
|
21 |
+
xtraDays=xtraDays
|
22 |
+
Acrew=DaysCrew
|
23 |
+
wkHrs=wkHrs
|
24 |
+
mySched=tls.preProcessData(Acrew,wkHrs,FTrefFl,TempRefFl,AssnFl,PollFl,assnWWF=assnWWF,xtraDays=xtraDays)
|
25 |
+
mySched.evalAssnList()
|
26 |
+
mySched.proofEligVol()
|
27 |
+
mySched.proofEligVol()#i don't know man i found in testing sometimes it wasnt completing properly the first time around
|
28 |
+
sch=mySched.fillOutSched_v3()
|
29 |
+
flNm=sch.printToExcel()
|
30 |
+
return flNm,datetime.now()
|
31 |
+
|
32 |
+
|
33 |
+
#######################
|
34 |
+
#Second Defining the Interface
|
35 |
with gr.Blocks() as demo:
|
36 |
with gr.Tab("A - Visual Template Builder"):
|
37 |
gr.Markdown("On this tab you can input a purely visual template (assignment tables empty) and have it primed for use in the scheduling algorithm. The info generated here will also be sent as inputs to tab B. See the documentation for more details on required formatting")
|
|
|
56 |
with gr.Column():
|
57 |
with gr.Tab("Non-File Inputs"):
|
58 |
with gr.Row():
|
59 |
+
B_wwfOT=gr.Radio(["Yes", "No"],label="Assign OT to WWF? (If 'yes', WWF will be considered for filling in slots beyond their prescribed shifts in the Assignment List)")
|
60 |
+
B_dayCrew=gr.Radio(["Bud","Blue"],label="Which crew is on A shift this week?")
|
61 |
with gr.Row():
|
62 |
+
B_wkHrs=gr.Radio([32, 40],label="Regular Work Hours This Week?")
|
63 |
+
B_xtraDay=gr.CheckboxGroup(["Friday", "Monday"], label="Check the boxes as appropriate if scheduling long weekend")
|
64 |
B_bt_MS = gr.Button("Generate Schedule")
|
65 |
B_fl_FS=gr.File(label="Generated Schedule")
|
66 |
+
B_tx_FTtimestamp=gr.Textbox(label="File Change Timestamp - Completed Schedule",placeholder="Waiting for first run")
|
67 |
with gr.Tab("C - Review"):
|
68 |
gr.Markdown("On this tab you can observe the template used to make the last generated scheduled by entering '0' for number of assignments. Positive values will yield the schedule in progress, stopped after making that many assignments.")
|
69 |
with gr.Row():
|
|
|
73 |
with gr.Column():
|
74 |
C_fl_PS=gr.File(label="Partially Complete Schedule")
|
75 |
C_bt_PS = gr.Button("Partially Generate Schedule")
|
76 |
+
|
77 |
+
#######################
|
78 |
+
#Third Define the Interactions
|
79 |
+
|
80 |
|
81 |
demo.launch()
|