Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ from PIL import Image # 5. Pillow for image processing
|
|
6 |
import openai # 6. OpenAI library for DALL路E API calls
|
7 |
import os # 7. OS for environment variables
|
8 |
from face_to_prompt import extract_face_prompt
|
|
|
9 |
|
10 |
|
11 |
# 8. Create the FastAPI app
|
@@ -36,7 +37,8 @@ async def generate(
|
|
36 |
with open("/tmp/temp_input.jpg", "wb") as f:
|
37 |
f.write(await image.read())
|
38 |
|
39 |
-
caption = extract_face_prompt("/tmp/temp_input.jpg")
|
|
|
40 |
|
41 |
# 16. Construct the DALL路E prompt using the style and the caption
|
42 |
prompt = (
|
|
|
6 |
import openai # 6. OpenAI library for DALL路E API calls
|
7 |
import os # 7. OS for environment variables
|
8 |
from face_to_prompt import extract_face_prompt
|
9 |
+
from desc import describe_image_with_gpt4o
|
10 |
|
11 |
|
12 |
# 8. Create the FastAPI app
|
|
|
37 |
with open("/tmp/temp_input.jpg", "wb") as f:
|
38 |
f.write(await image.read())
|
39 |
|
40 |
+
# caption = extract_face_prompt("/tmp/temp_input.jpg")
|
41 |
+
caption = describe_image_with_gpt4o("/tmp/temp_input.jpg",OPENAI_API_KEY)
|
42 |
|
43 |
# 16. Construct the DALL路E prompt using the style and the caption
|
44 |
prompt = (
|