Spaces:
Running
Running
jeremyLE-Ekimetrics
commited on
Commit
·
cce7334
1
Parent(s):
073b060
added prompt random
Browse files
main.py
CHANGED
@@ -9,14 +9,15 @@ client = OpenAI()
|
|
9 |
import streamlit as st
|
10 |
from PIL import Image
|
11 |
from diffusers import AutoPipelineForText2Image
|
12 |
-
|
13 |
@st.cache_data(ttl=600)
|
14 |
def get_prompt_to_guess():
|
|
|
15 |
response = client.chat.completions.create(
|
16 |
model="gpt-3.5-turbo",
|
17 |
messages=[
|
18 |
{"role": "system", "content": "You are a helpful assistant to generate one simple prompt in order to generate an image. Your given prompt won't go over 10 words. You only return the prompt. You will also answer in french."},
|
19 |
-
{"role": "user", "content": "Donne moi un prompt pour generer une image"},
|
20 |
]
|
21 |
)
|
22 |
return response.choices[0].message.content
|
|
|
9 |
import streamlit as st
|
10 |
from PIL import Image
|
11 |
from diffusers import AutoPipelineForText2Image
|
12 |
+
import random
|
13 |
@st.cache_data(ttl=600)
|
14 |
def get_prompt_to_guess():
|
15 |
+
random_prompt = ["tree", "cat", "dog", "consultant", "artificial intelligence", "beauty", "immeuble", "plage", "cyborg", "futuristic"]
|
16 |
response = client.chat.completions.create(
|
17 |
model="gpt-3.5-turbo",
|
18 |
messages=[
|
19 |
{"role": "system", "content": "You are a helpful assistant to generate one simple prompt in order to generate an image. Your given prompt won't go over 10 words. You only return the prompt. You will also answer in french."},
|
20 |
+
{"role": "user", "content": f"Donne moi un prompt pour generer une image de {random.choice(random_prompt)}"},
|
21 |
]
|
22 |
)
|
23 |
return response.choices[0].message.content
|