Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -382,25 +382,30 @@ def process_with_gpt(text_input):
|
|
382 |
def process_with_claude(text_input):
|
383 |
"""Process text with Claude."""
|
384 |
if text_input:
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
"
|
402 |
-
|
403 |
-
|
|
|
|
|
|
|
|
|
|
|
404 |
|
405 |
# File Management Functions
|
406 |
def load_file(file_name):
|
|
|
382 |
def process_with_claude(text_input):
|
383 |
"""Process text with Claude."""
|
384 |
if text_input:
|
385 |
+
|
386 |
+
with st.chat_message("user"):
|
387 |
+
st.markdown(text_input)
|
388 |
+
|
389 |
+
with st.chat_message("assistant"):
|
390 |
+
response = claude_client.messages.create(
|
391 |
+
model="claude-3-sonnet-20240229",
|
392 |
+
max_tokens=1000,
|
393 |
+
messages=[
|
394 |
+
{"role": "user", "content": text_input}
|
395 |
+
]
|
396 |
+
)
|
397 |
+
response_text = response.content[0].text
|
398 |
+
st.write("Claude: " + response_text)
|
399 |
+
|
400 |
+
#filename = generate_filename(text_input, "md")
|
401 |
+
filename = generate_filename("GPT-4o: " + response_text, "md")
|
402 |
+
create_file(filename, text_input, response_text)
|
403 |
+
|
404 |
+
st.session_state.chat_history.append({
|
405 |
+
"user": text_input,
|
406 |
+
"claude": response_text
|
407 |
+
})
|
408 |
+
return response_text
|
409 |
|
410 |
# File Management Functions
|
411 |
def load_file(file_name):
|