wishmi1234 commited on
Commit
0c8ace7
·
verified ·
1 Parent(s): 3e00fcf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -4
app.py CHANGED
@@ -36,19 +36,40 @@ Your output must be: a single clean answer string only.
36
 
37
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
38
 
39
-
40
  class ImageCaptioningTool(Tool):
41
  name = "image_captioner"
42
  description = "Generate a caption for an image."
43
- inputs = {"image": Any, "question": "str"}
 
 
 
 
 
 
 
 
 
44
  output_type = "text"
45
-
46
  def run(self, inputs: dict) -> str:
47
  image = inputs.get("image")
48
  if not image:
49
  return "No image provided."
50
- # You could run your model here instead
51
  return "This is a placeholder caption for the uploaded image."
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
 
54
  # ---------------------- TOOL CONFIGURATION ---------------------- #
 
36
 
37
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
38
 
 
39
  class ImageCaptioningTool(Tool):
40
  name = "image_captioner"
41
  description = "Generate a caption for an image."
42
+ inputs = {
43
+ "image": {
44
+ "type": "dict",
45
+ "description": "A dictionary containing image data in PIL format."
46
+ },
47
+ "question": {
48
+ "type": "str",
49
+ "description": "A question or prompt about the image."
50
+ }
51
+ }
52
  output_type = "text"
53
+
54
  def run(self, inputs: dict) -> str:
55
  image = inputs.get("image")
56
  if not image:
57
  return "No image provided."
58
+ # Here you can process the image using your model
59
  return "This is a placeholder caption for the uploaded image."
60
+
61
+ # class ImageCaptioningTool(Tool):
62
+ # name = "image_captioner"
63
+ # description = "Generate a caption for an image."
64
+ # inputs = {"image": Any, "question": "str"}
65
+ # output_type = "text"
66
+
67
+ # def run(self, inputs: dict) -> str:
68
+ # image = inputs.get("image")
69
+ # if not image:
70
+ # return "No image provided."
71
+ # # You could run your model here instead
72
+ # return "This is a placeholder caption for the uploaded image."
73
 
74
 
75
  # ---------------------- TOOL CONFIGURATION ---------------------- #