Spaces:
Running
on
T4
Running
on
T4
MCP ready
Browse files
app.py
CHANGED
|
@@ -43,6 +43,22 @@ ci = Interrogator(config)
|
|
| 43 |
|
| 44 |
|
| 45 |
def inference(image, mode, best_max_flavors):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
image = image.convert('RGB')
|
|
@@ -133,4 +149,4 @@ with gr.Blocks(css=css) as demo:
|
|
| 133 |
|
| 134 |
submit_btn.click(fn=inference, inputs=[input_image,mode_input,flavor_input], outputs=[output_text], api_name="clipi2")
|
| 135 |
|
| 136 |
-
demo.queue(max_size=32).launch(show_api=False)
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
def inference(image, mode, best_max_flavors):
|
| 46 |
+
"""
|
| 47 |
+
Generate a descriptive prompt from an input image using different interrogation modes.
|
| 48 |
+
|
| 49 |
+
Args:
|
| 50 |
+
image: A PIL Image object representing the input image to be analyzed.
|
| 51 |
+
mode: A string specifying the interrogation mode to use.
|
| 52 |
+
Can be one of ['best', 'classic', 'fast']:
|
| 53 |
+
- 'best': Produces a prompt using the 'best' interrogation mode with max flavors control.
|
| 54 |
+
- 'classic': Uses the classic interrogation method.
|
| 55 |
+
- 'fast': Uses a faster but less detailed interrogation method.
|
| 56 |
+
best_max_flavors: An integer controlling the maximum number of flavor descriptors
|
| 57 |
+
when using 'best' mode (ignored in other modes).
|
| 58 |
+
|
| 59 |
+
Returns:
|
| 60 |
+
A string containing the generated prompt describing the image.
|
| 61 |
+
"""
|
| 62 |
|
| 63 |
|
| 64 |
image = image.convert('RGB')
|
|
|
|
| 149 |
|
| 150 |
submit_btn.click(fn=inference, inputs=[input_image,mode_input,flavor_input], outputs=[output_text], api_name="clipi2")
|
| 151 |
|
| 152 |
+
demo.queue(max_size=32).launch(show_api=True, ssr_mode=False, mcp_server=True)
|