File size: 1,034 Bytes
3b6c254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from PIL import Image
import streamlit as st
import os
from Pages.imageBB import run

# Main function
def CREATEVISUALS():
    st.title("Create photoshoot visual")

    # Set the directory where the uploaded images will be saved
    UPLOAD_DIR = 'uploaded_images'

    # Create the directory if it doesn't exist
    if not os.path.exists(UPLOAD_DIR):
        os.makedirs(UPLOAD_DIR)

    # Streamlit app title
    st.header("Image Upload and Save App")

    # File uploader allows user to upload an image
    uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])

    if uploaded_file is not None:
        # Open the uploaded image
        image = Image.open(uploaded_file)

        # Save the uploaded image to the specified directory
        image_path = os.path.join(UPLOAD_DIR, uploaded_file.name)
        image.save(image_path)
        
        st.write(f"Image Saved")
        run(image_path)


    else:
        st.write("No image uploaded yet.")

if __name__ == "__main__":
    CREATEVISUALS()