lyimo commited on
Commit
7a9342b
Β·
1 Parent(s): b3437e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -20,7 +20,7 @@ llm = Llama(
20
  history = []
21
 
22
  system_message = """
23
- You are a BIRD EXPERT
24
  """
25
  # The rest of the system message
26
 
@@ -71,14 +71,14 @@ def predict(img):
71
 
72
  title = "Bird Detector with LLM"
73
  description = "Detect birds and get LLM responses."
74
- examples = [{"img": "BIRD.jpg", "message": "Tell me about the bird."}]
75
  interpretation = 'default'
76
  enable_queue = True
77
 
78
  def combined(img, message):
79
  prediction = predict(img)
80
  response = list(generate_text(f"I have detected {prediction['bird']} in the image. {message}", history))
81
- return response
82
 
83
  gr.Interface(
84
  fn=combined,
@@ -91,5 +91,4 @@ gr.Interface(
91
  description=description,
92
  examples=examples,
93
  interpretation=interpretation,
94
- enable_queue=enable_queue,
95
  ).launch()
 
20
  history = []
21
 
22
  system_message = """
23
+ You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe...
24
  """
25
  # The rest of the system message
26
 
 
71
 
72
  title = "Bird Detector with LLM"
73
  description = "Detect birds and get LLM responses."
74
+ examples = [{"img": "BIRD.png", "message": "Tell me about the bird."}]
75
  interpretation = 'default'
76
  enable_queue = True
77
 
78
  def combined(img, message):
79
  prediction = predict(img)
80
  response = list(generate_text(f"I have detected {prediction['bird']} in the image. {message}", history))
81
+ return response[0] # Return the first generated response
82
 
83
  gr.Interface(
84
  fn=combined,
 
91
  description=description,
92
  examples=examples,
93
  interpretation=interpretation,
 
94
  ).launch()