Update app.py
Browse files
app.py
CHANGED
@@ -225,21 +225,18 @@ with st.sidebar:
|
|
225 |
)
|
226 |
|
227 |
# Input text box (now using text_area instead of text_input)
|
228 |
-
|
229 |
-
|
230 |
-
if
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
output = response.text.strip()
|
240 |
-
|
241 |
# Display result
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
st.error(f"An error occurred: {str(e)}")
|
|
|
225 |
)
|
226 |
|
227 |
# Input text box (now using text_area instead of text_input)
|
228 |
+
user_input = st.text_area("Enter your input:", height=150)
|
229 |
+
if st.button("Generate"):
|
230 |
+
if user_input:
|
231 |
+
# Create prompt with history and new input
|
232 |
+
prompt = history.copy()
|
233 |
+
prompt.extend([f"input: {user_input}", "output: "])
|
234 |
+
print(prompt)
|
235 |
+
# Generate response
|
236 |
+
try:
|
237 |
+
response = model.generate_content(prompt)
|
238 |
+
output = response.text.strip()
|
|
|
|
|
239 |
# Display result
|
240 |
+
st.success(f"Output: {output}")
|
241 |
+
except Exception as e:
|
242 |
+
st.error(f"An error occurred: {str(e)}")
|
|