awacke1 commited on
Commit
412e9af
1 Parent(s): 00a4cdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -19
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
- response = claude_client.messages.create(
386
- model="claude-3-sonnet-20240229",
387
- max_tokens=1000,
388
- messages=[
389
- {"role": "user", "content": text_input}
390
- ]
391
- )
392
- response_text = response.content[0].text
393
- st.write("Claude: " + response_text)
394
-
395
- #filename = generate_filename(text_input, "md")
396
- filename = generate_filename("GPT-4o: " + response_text, "md")
397
- create_file(filename, text_input, response_text)
398
-
399
- st.session_state.chat_history.append({
400
- "user": text_input,
401
- "claude": response_text
402
- })
403
- return response_text
 
 
 
 
 
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):