File size: 1,414 Bytes
fb96795
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
# import openai
import replicate

def page2():
    st.title("OpenAI DALL·E Image Generation")
    st.info("""#### NOTE: you can download image by \
    right clicking on the image and select save image as option""")

    with st.form(key='form'):
        prompt = st.text_input(label='Enter text prompt for image generation')
        size = st.selectbox('Select size of the images', 
                            ('256x256', '512x512', '1024x1024'))
        num_images = st.selectbox('Enter number of images to be generated', (1,2,3,4))
        submit_button = st.form_submit_button(label='Submit')

    if submit_button:
        if prompt:
            output = replicate.run(
                "stability-ai/stable-video-diffusion:3f0457e4619daac51203dedb472816fd4af51f3149fa7a9e0b5ffcf1b8172438",
                input={
                    "input_image": "https://example.com/path/to/file/input_image"
                }
            )
            print(output)
            
            # response = openai.Image.create(
            #         prompt = prompt,
            #         n = num_images,
            #         size=size,
            #     )
            
            # for idx in range(num_images):
            #     image_url = response["data"][idx]["url"]

            #     st.image(image_url, caption=f"Generated image: {idx+1}",
            #              use_column_width=True)