Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,25 +22,24 @@ def login(username, password):
|
|
22 |
|
23 |
def upload_files(creators_file, overnight_file, day_file, prime_file):
|
24 |
try:
|
25 |
-
# Save each file using
|
26 |
with open(os.path.join(UPLOAD_FOLDER, "creators_file.xlsx"), "wb") as f:
|
27 |
-
f.write(creators_file
|
28 |
|
29 |
with open(os.path.join(UPLOAD_FOLDER, "overnight_file.xlsx"), "wb") as f:
|
30 |
-
f.write(overnight_file
|
31 |
|
32 |
with open(os.path.join(UPLOAD_FOLDER, "day_file.xlsx"), "wb") as f:
|
33 |
-
f.write(day_file
|
34 |
|
35 |
with open(os.path.join(UPLOAD_FOLDER, "prime_file.xlsx"), "wb") as f:
|
36 |
-
f.write(prime_file
|
37 |
|
38 |
return "Files uploaded successfully!"
|
39 |
except Exception as e:
|
40 |
return f"Error uploading files: {e}"
|
41 |
|
42 |
|
43 |
-
|
44 |
def generate_main_accounts():
|
45 |
creators_file = os.path.join(UPLOAD_FOLDER, "creators_file.xlsx")
|
46 |
chatter_files = [
|
@@ -90,10 +89,10 @@ def app():
|
|
90 |
login_btn.click(login, inputs=[username, password], outputs=[login_status])
|
91 |
|
92 |
with gr.Tab("Upload Files"):
|
93 |
-
creators_file = gr.File(label="Creators File")
|
94 |
-
overnight_file = gr.File(label="Overnight File")
|
95 |
-
day_file = gr.File(label="Day File")
|
96 |
-
prime_file = gr.File(label="Prime File")
|
97 |
upload_btn = gr.Button("Upload Files")
|
98 |
upload_status = gr.Textbox(label="Upload Status", interactive=False)
|
99 |
|
@@ -121,3 +120,4 @@ def app():
|
|
121 |
# Launch Gradio App
|
122 |
if __name__ == "__main__":
|
123 |
app().launch()
|
|
|
|
22 |
|
23 |
def upload_files(creators_file, overnight_file, day_file, prime_file):
|
24 |
try:
|
25 |
+
# Save each file using its binary data
|
26 |
with open(os.path.join(UPLOAD_FOLDER, "creators_file.xlsx"), "wb") as f:
|
27 |
+
f.write(creators_file.read())
|
28 |
|
29 |
with open(os.path.join(UPLOAD_FOLDER, "overnight_file.xlsx"), "wb") as f:
|
30 |
+
f.write(overnight_file.read())
|
31 |
|
32 |
with open(os.path.join(UPLOAD_FOLDER, "day_file.xlsx"), "wb") as f:
|
33 |
+
f.write(day_file.read())
|
34 |
|
35 |
with open(os.path.join(UPLOAD_FOLDER, "prime_file.xlsx"), "wb") as f:
|
36 |
+
f.write(prime_file.read())
|
37 |
|
38 |
return "Files uploaded successfully!"
|
39 |
except Exception as e:
|
40 |
return f"Error uploading files: {e}"
|
41 |
|
42 |
|
|
|
43 |
def generate_main_accounts():
|
44 |
creators_file = os.path.join(UPLOAD_FOLDER, "creators_file.xlsx")
|
45 |
chatter_files = [
|
|
|
89 |
login_btn.click(login, inputs=[username, password], outputs=[login_status])
|
90 |
|
91 |
with gr.Tab("Upload Files"):
|
92 |
+
creators_file = gr.File(label="Creators File", type="file")
|
93 |
+
overnight_file = gr.File(label="Overnight File", type="file")
|
94 |
+
day_file = gr.File(label="Day File", type="file")
|
95 |
+
prime_file = gr.File(label="Prime File", type="file")
|
96 |
upload_btn = gr.Button("Upload Files")
|
97 |
upload_status = gr.Textbox(label="Upload Status", interactive=False)
|
98 |
|
|
|
120 |
# Launch Gradio App
|
121 |
if __name__ == "__main__":
|
122 |
app().launch()
|
123 |
+
|