Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,8 @@ from google.genai import types
|
|
| 13 |
|
| 14 |
def save_binary_file(file_name, data):
|
| 15 |
with open(file_name, "wb") as f:
|
| 16 |
-
f.write(data
|
|
|
|
| 17 |
|
| 18 |
def generate(text, file_name, api_key, model="gemini-2.0-flash-exp"):
|
| 19 |
# Initialize client using provided api_key (or fallback to env variable)
|
|
@@ -93,8 +94,7 @@ def generate(text, file_name, api_key, model="gemini-2.0-flash-exp"):
|
|
| 93 |
# Continue with the function, returning empty responses
|
| 94 |
except Exception as e:
|
| 95 |
print(f"Error in Gemini API setup: {str(e)}")
|
| 96 |
-
return None
|
| 97 |
-
, f"Error: {str(e)}"
|
| 98 |
finally:
|
| 99 |
# Always clean up files
|
| 100 |
try:
|
|
|
|
| 13 |
|
| 14 |
def save_binary_file(file_name, data):
|
| 15 |
with open(file_name, "wb") as f:
|
| 16 |
+
f.write(data
|
| 17 |
+
)
|
| 18 |
|
| 19 |
def generate(text, file_name, api_key, model="gemini-2.0-flash-exp"):
|
| 20 |
# Initialize client using provided api_key (or fallback to env variable)
|
|
|
|
| 94 |
# Continue with the function, returning empty responses
|
| 95 |
except Exception as e:
|
| 96 |
print(f"Error in Gemini API setup: {str(e)}")
|
| 97 |
+
return None, f"Error: {str(e)}"
|
|
|
|
| 98 |
finally:
|
| 99 |
# Always clean up files
|
| 100 |
try:
|