suayptalha commited on
Commit
9b3c34f
·
verified ·
1 Parent(s): fab8ffe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -23,12 +23,13 @@ def describe_image(image, user_message):
23
  description = result # Moondream2'nin cevabını alıyoruz
24
 
25
  # LLaMA API'sine açıklamayı ve kullanıcının mesajını gönderiyoruz
26
- history.append(("User", user_message))
27
- history.append(("Assistant", description))
28
 
 
 
29
  llama_result = llama_client.predict(
30
- message=user_message,
31
- history=history,
32
  api_name="/chat"
33
  )
34
 
@@ -44,10 +45,10 @@ def chat_or_image(image, user_message):
44
  return describe_image(image, user_message)
45
  else:
46
  # Resim yoksa, direkt LLaMA'ya mesajı gönderiyoruz
47
- history.append(("User", user_message))
 
48
  llama_result = llama_client.predict(
49
- message=user_message,
50
- history=history,
51
  api_name="/chat"
52
  )
53
  return llama_result
 
23
  description = result # Moondream2'nin cevabını alıyoruz
24
 
25
  # LLaMA API'sine açıklamayı ve kullanıcının mesajını gönderiyoruz
26
+ history.append(f"User: {user_message}")
27
+ history.append(f"Assistant: {description}")
28
 
29
+ # Sohbet geçmişini birleştirip tek bir mesaj olarak LLaMA'ya gönderiyoruz
30
+ full_conversation = "\n".join(history)
31
  llama_result = llama_client.predict(
32
+ message=full_conversation,
 
33
  api_name="/chat"
34
  )
35
 
 
45
  return describe_image(image, user_message)
46
  else:
47
  # Resim yoksa, direkt LLaMA'ya mesajı gönderiyoruz
48
+ history.append(f"User: {user_message}")
49
+ full_conversation = "\n".join(history)
50
  llama_result = llama_client.predict(
51
+ message=full_conversation,
 
52
  api_name="/chat"
53
  )
54
  return llama_result