ProfessorLeVesseur commited on
Commit
ad1818d
1 Parent(s): e353b8d

Upload 3 files

Browse files
MTSS.ai_Logo.png ADDED
PromptCanvas_ImageGenerator.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ # import base64
3
+ import openai
4
+
5
+ import os
6
+ from pathlib import Path
7
+ from dotenv import load_dotenv
8
+ load_dotenv()
9
+
10
+ # Streamlit page setup
11
+ st.set_page_config(page_title="Pixel Generator", layout="centered", initial_sidebar_state="collapsed")
12
+
13
+ #Add the image with a specified width
14
+ image_width = 300 # Set the desired width in pixels
15
+ # st.image('MTSS.ai_Logo.png', width=image_width)
16
+ st.image('/Users/cheynelevesseur/Desktop/Python_Code/LLM_Projects/LLM_Vision/MTSS.ai_Logo.png', width=image_width)
17
+
18
+ st.header('PromptCanvas™ | Images')
19
+ st.subheader('Image Generator')
20
+
21
+ # Retrieve the OpenAI API Key from secrets
22
+ # openai.api_key = st.secrets["openai_api_key"]
23
+
24
+ # Set the OpenAI API key
25
+ # Retrieve OpenAI API key from environment variables
26
+ openai_api_key = os.getenv('OPENAI_API_KEY')
27
+ if not openai_api_key:
28
+ raise ValueError("OPENAI_API_KEY not set in environment variables")
29
+ # Set the OpenAI API key
30
+ openai.api_key = openai_api_key
31
+
32
+ def generate_images(prompt): #def generate_images(image_description, num_images):
33
+ response = openai.images.generate(
34
+ model="dall-e-3",
35
+ prompt = prompt,
36
+ size="1024x1024",
37
+ quality="standard",
38
+ n = 1,
39
+ )
40
+ image_url = response.data[0].url
41
+ return image_url
42
+
43
+ prompt = st.text_area("Enter a description for the image you want to generate")
44
+
45
+ #create a button
46
+ if st.button("Generate Images"):
47
+ generate_image=generate_images(prompt) #generate_image=generate_images(prompt, num_of_images)
48
+ st.image(generate_image)
49
+
50
+
51
+
52
+
53
+
54
+
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ openai
2
+ langchain
3
+ streamlit