Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,10 @@ from openai import OpenAI
|
|
| 6 |
|
| 7 |
client = OpenAI()
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def row_to_text(row):
|
| 10 |
return (
|
| 11 |
f"Clinic: {row['Account_Name']}\n"
|
|
@@ -63,13 +67,14 @@ def contextual_pitch_assistant(csv_file, query):
|
|
| 63 |
import re
|
| 64 |
match = re.search(r"(Image prompt|DALL路E prompt)[:\-]\s*(.*)", output_text)
|
| 65 |
image_prompt = match.group(2).strip() if match else "modern dental clinic interior with dentist and patient"
|
| 66 |
-
|
| 67 |
image = client.images.generate(
|
| 68 |
model="gpt-image-1",
|
| 69 |
prompt=image_prompt,
|
| 70 |
size="1024x1024"
|
| 71 |
)
|
| 72 |
image_url = image.data[0].url
|
|
|
|
| 73 |
|
| 74 |
html = f"""
|
| 75 |
<div style='font-family:Arial,sans-serif;max-width:600px;margin:auto;padding:16px;background:#ffffff;
|
|
|
|
| 6 |
|
| 7 |
client = OpenAI()
|
| 8 |
|
| 9 |
+
import os
|
| 10 |
+
client = OpenAI(api_key=os.getenv("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"))
|
| 11 |
+
|
| 12 |
+
|
| 13 |
def row_to_text(row):
|
| 14 |
return (
|
| 15 |
f"Clinic: {row['Account_Name']}\n"
|
|
|
|
| 67 |
import re
|
| 68 |
match = re.search(r"(Image prompt|DALL路E prompt)[:\-]\s*(.*)", output_text)
|
| 69 |
image_prompt = match.group(2).strip() if match else "modern dental clinic interior with dentist and patient"
|
| 70 |
+
|
| 71 |
image = client.images.generate(
|
| 72 |
model="gpt-image-1",
|
| 73 |
prompt=image_prompt,
|
| 74 |
size="1024x1024"
|
| 75 |
)
|
| 76 |
image_url = image.data[0].url
|
| 77 |
+
|
| 78 |
|
| 79 |
html = f"""
|
| 80 |
<div style='font-family:Arial,sans-serif;max-width:600px;margin:auto;padding:16px;background:#ffffff;
|