Update app.py
Browse files
app.py
CHANGED
@@ -128,7 +128,7 @@ history = [
|
|
128 |
"output: 1. on the contrary, they have every incentive to establish a foothold in them, as long as the area's residents are not those who will ultimately reside there.",
|
129 |
"input: n = 1\nthis gentrification process begins with the acquisition of land at a cheap price, made possible by the neighborhood's depressed socioeconomic conditions. from there, the next step is to repackage the property in a way that will appeal to successive tiers of the income distribution, moving from those with more moderate earnings to those in the upper echelons. as the wealth profile of the area rises, so too does the price of rent, each step of the way yielding fatter profits for real estate interests. {guide: make it seem really unfair} ->",
|
130 |
"output: 1. in this race to the top, there is no place for those already residing there, who can only watch as the community they once called home is unceremoniously auctioned off to the highest bidder.",
|
131 |
-
"input: n = 1\n[we now know the laptop to be real; but there were legitimate questions about it in 2020]
|
132 |
"output: 1. the laptop's authenticity, now confirmed, was a matter of justifiable uncertainty in 2020.",
|
133 |
"input: n = 2\njoe rogan bills himself as an open-minded interviewer who welcomes conflicting views. [expectation from being that; when the ukraine president asked joe rogan if he could appear on the joe rogan podcast; he would be accepted] ->",
|
134 |
"output: 1. one would reasonably assume that, true to his word, he would then welcome the opportunity to engage with volodymyr zelenskyy when the ukrainian president sought a platform on his show.\n2. if his claims are to be taken at face value, then surely he would embrace the chance to interview volodymyr zelenskyy when the ukrainian president requested a spot on his show.",
|
@@ -225,6 +225,7 @@ with st.sidebar:
|
|
225 |
api_key = "AIzaSyB93eoXaU48hrJ2hojk-2gQPj28dGVSIbQ"
|
226 |
backup_api_key = "AIzaSyDNWizNQAA0UaflR5f_zTF6FcMSIA5D8RU"
|
227 |
backup_api_key_2 = "AIzaSyCrhuU-XT142KWB_zmA807qeJcE0dEjeJw"
|
|
|
228 |
|
229 |
genai.configure(api_key=api_key)
|
230 |
|
@@ -261,7 +262,6 @@ if st.button("Generate"):
|
|
261 |
model_name=model_name,
|
262 |
generation_config=generation_config,
|
263 |
)
|
264 |
-
# Retry with first backup API key
|
265 |
response = model.generate_content(prompt)
|
266 |
output = response.text.strip()
|
267 |
st.success(f"Output: {output}")
|
@@ -273,11 +273,21 @@ if st.button("Generate"):
|
|
273 |
model_name=model_name,
|
274 |
generation_config=generation_config,
|
275 |
)
|
276 |
-
# Retry with second backup API key
|
277 |
response = model.generate_content(prompt)
|
278 |
output = response.text.strip()
|
279 |
st.success(f"Output: {output}")
|
280 |
except Exception as backup_error_2:
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
else:
|
283 |
st.error(f"An error occurred: {str(e)}")
|
|
|
128 |
"output: 1. on the contrary, they have every incentive to establish a foothold in them, as long as the area's residents are not those who will ultimately reside there.",
|
129 |
"input: n = 1\nthis gentrification process begins with the acquisition of land at a cheap price, made possible by the neighborhood's depressed socioeconomic conditions. from there, the next step is to repackage the property in a way that will appeal to successive tiers of the income distribution, moving from those with more moderate earnings to those in the upper echelons. as the wealth profile of the area rises, so too does the price of rent, each step of the way yielding fatter profits for real estate interests. {guide: make it seem really unfair} ->",
|
130 |
"output: 1. in this race to the top, there is no place for those already residing there, who can only watch as the community they once called home is unceremoniously auctioned off to the highest bidder.",
|
131 |
+
"input: n = 1\n[we now know the laptop to be real; but there were legitimate questions about it in 2020] ->\n make it seem totally fair people were skepitcal",
|
132 |
"output: 1. the laptop's authenticity, now confirmed, was a matter of justifiable uncertainty in 2020.",
|
133 |
"input: n = 2\njoe rogan bills himself as an open-minded interviewer who welcomes conflicting views. [expectation from being that; when the ukraine president asked joe rogan if he could appear on the joe rogan podcast; he would be accepted] ->",
|
134 |
"output: 1. one would reasonably assume that, true to his word, he would then welcome the opportunity to engage with volodymyr zelenskyy when the ukrainian president sought a platform on his show.\n2. if his claims are to be taken at face value, then surely he would embrace the chance to interview volodymyr zelenskyy when the ukrainian president requested a spot on his show.",
|
|
|
225 |
api_key = "AIzaSyB93eoXaU48hrJ2hojk-2gQPj28dGVSIbQ"
|
226 |
backup_api_key = "AIzaSyDNWizNQAA0UaflR5f_zTF6FcMSIA5D8RU"
|
227 |
backup_api_key_2 = "AIzaSyCrhuU-XT142KWB_zmA807qeJcE0dEjeJw"
|
228 |
+
backup_api_key_3 = "AIzaSyB1VY6u-S1NcQ8lqyKKQckGVG1c8jE9Qdw" # New API key added
|
229 |
|
230 |
genai.configure(api_key=api_key)
|
231 |
|
|
|
262 |
model_name=model_name,
|
263 |
generation_config=generation_config,
|
264 |
)
|
|
|
265 |
response = model.generate_content(prompt)
|
266 |
output = response.text.strip()
|
267 |
st.success(f"Output: {output}")
|
|
|
273 |
model_name=model_name,
|
274 |
generation_config=generation_config,
|
275 |
)
|
|
|
276 |
response = model.generate_content(prompt)
|
277 |
output = response.text.strip()
|
278 |
st.success(f"Output: {output}")
|
279 |
except Exception as backup_error_2:
|
280 |
+
try:
|
281 |
+
# Switch to third backup API key
|
282 |
+
genai.configure(api_key=backup_api_key_3)
|
283 |
+
model = genai.GenerativeModel(
|
284 |
+
model_name=model_name,
|
285 |
+
generation_config=generation_config,
|
286 |
+
)
|
287 |
+
response = model.generate_content(prompt)
|
288 |
+
output = response.text.strip()
|
289 |
+
st.success(f"Output: {output}")
|
290 |
+
except Exception as backup_error_3:
|
291 |
+
st.error(f"All API keys failed: {str(backup_error_3)}")
|
292 |
else:
|
293 |
st.error(f"An error occurred: {str(e)}")
|