Spaces:
Sleeping
Sleeping
Update image_gen.py
Browse files- image_gen.py +2 -0
image_gen.py
CHANGED
|
@@ -177,6 +177,8 @@ def generate_image(prompt_text, style, model="hf"):
|
|
| 177 |
headers_pexels = {
|
| 178 |
"Authorization": pexels_api_key
|
| 179 |
}
|
|
|
|
|
|
|
| 180 |
new_prompt = client.models.generate_content(model="models/gemini-2.0-flash-lite", contents=f"Generate keywords or a phrase to search for an appropriate image on the pexels API based on this prompt: {prompt_text} return only the keywords and nothing else")
|
| 181 |
pexel_prompt = str(new_prompt.text)
|
| 182 |
|
|
|
|
| 177 |
headers_pexels = {
|
| 178 |
"Authorization": pexels_api_key
|
| 179 |
}
|
| 180 |
+
g_api_key = os.getenv("GEMINI")
|
| 181 |
+
client = genai.Client(api_key=g_api_key)
|
| 182 |
new_prompt = client.models.generate_content(model="models/gemini-2.0-flash-lite", contents=f"Generate keywords or a phrase to search for an appropriate image on the pexels API based on this prompt: {prompt_text} return only the keywords and nothing else")
|
| 183 |
pexel_prompt = str(new_prompt.text)
|
| 184 |
|