rtaormina commited on
Commit
096d617
·
verified ·
1 Parent(s): b7d5115

Add accordions for prompts

Browse files
Files changed (1) hide show
  1. app.py +33 -32
app.py CHANGED
@@ -93,38 +93,39 @@ with gr.Blocks(css=css) as demo:
93
  txt_out_CogVLM = gr.Textbox(label="CogVLM", lines= n_lines, max_lines=n_lines)
94
  txt_out_LLaVa = gr.Textbox(label="LLaVa", lines= n_lines, max_lines=n_lines)
95
  with gr.Row():
96
- gr.Markdown("""
97
- #### Prompt used for GPT4-V, CogVLM and LLaVA
98
- You are a virtual sewer technician with the capability to analyze images from CCTV cameras taken inside sewer pipes.
99
- Your task is to examine each image and provide a concise, yet accurate, summary for retrieval.
100
- After summarizing, you must classify the image as DEFECTIVE or NON DEFECTIVE.
101
- While providing the summary, remember the following guidelines:"
102
- 1) Provide a general overview of the image that you see, describing important elements such image clarity, lighting conditions, type of pipe (concrete, PVC, ...), presence of water.
103
- 2) Check for defects in the sewer pipes in the image.
104
- 3) Pipes in good condition usually show a smooth, unbroken surface, no visible signs of damage like cracks or collapses, and an absence of blockages such as roots.
105
- 4) On the other hand, you can have the following defects:
106
- 4a)Cracks, Breaks, and Collapses: Identify visible cracks along the pipe, instances where the pipe has fractured or completely broken apart, and areas where the pipe has collapsed.
107
- This includes longitudinal cracks, circumferential breaks, and complete structural failures that compromise the integrity of the sewer system.
108
- 4b)Surface Damage: Detect areas of the pipe's interior that exhibit signs of wear, erosion, or damage on the surface.
109
- This includes minor scratches, pitting, scaling, or any form of deterioration that affects the pipe's surface but does not necessarily penetrate deeply into the structure.
110
- 4c) Production Error: Identify defects that originated during the pipe's manufacturing process, such as inconsistent pipe thickness, improper joint alignment, or material imperfections.
111
- These are flaws that were introduced before installation and could potentially affect the pipe's performance or longevity.
112
- 4d) Deformations: Recognize any alterations in the shape of the pipe, such as bending, sagging, or bulging, that indicate a deformation.
113
- This includes both minor deformations that may affect flow efficiency and major deformations that threaten the pipe's structural integrity.
114
- 4e) Roots: Detect the presence of roots infiltrating the sewer pipe, whether through joints, cracks, or other vulnerabilities.
115
- This involves identifying both the initial stages of root intrusion and the more advanced stages where roots have significantly obstructed the pipe.
116
- 5) Additional considerations while analyzing the images: do not consider blurred text or user-defined circled areas in the images.
117
- 6) You will always try to describe the image that you see.
118
- You must provide your output in JSON format with DESCRIPTION: <your description of the image>, PREDICTION: <your prediction, either DEFECTIVE or NON DEFECTIVE>
119
-
120
- #### Basic prompt used for GPT4-V
121
- You are a virtual sewer technician with the capability to analyze images from CCTV cameras taken inside sewer pipes.
122
- Your task is to examine each image and provide a concise, yet accurate, summary for retrieval.
123
- After summarizing, you must classify the image as DEFECTIVE or NON DEFECTIVE.
124
- You will always try to describe the image that you see.
125
- You must provide your output in JSON format with DESCRIPTION: <your description of the image>, PREDICTION: <your prediction, either DEFECTIVE or NON DEFECTIVE>
126
- """)
127
-
 
128
 
129
  prev_btn.click(fn=return_prev, inputs=index, outputs=[index, txt_item, img_out,
130
  txt_out_GPT4, txt_out_GPT4s,
 
93
  txt_out_CogVLM = gr.Textbox(label="CogVLM", lines= n_lines, max_lines=n_lines)
94
  txt_out_LLaVa = gr.Textbox(label="LLaVa", lines= n_lines, max_lines=n_lines)
95
  with gr.Row():
96
+ with gr.Accordion("Prompt used for GPT4-V, CogVLM and LLaVA"):
97
+ gr.Markdown("""
98
+ You are a virtual sewer technician with the capability to analyze images from CCTV cameras taken inside sewer pipes.
99
+ Your task is to examine each image and provide a concise, yet accurate, summary for retrieval.
100
+ After summarizing, you must classify the image as DEFECTIVE or NON DEFECTIVE.
101
+ While providing the summary, remember the following guidelines:"
102
+ 1) Provide a general overview of the image that you see, describing important elements such image clarity, lighting conditions, type of pipe (concrete, PVC, ...), presence of water.
103
+ 2) Check for defects in the sewer pipes in the image.
104
+ 3) Pipes in good condition usually show a smooth, unbroken surface, no visible signs of damage like cracks or collapses, and an absence of blockages such as roots.
105
+ 4) On the other hand, you can have the following defects:
106
+ 4a)Cracks, Breaks, and Collapses: Identify visible cracks along the pipe, instances where the pipe has fractured or completely broken apart, and areas where the pipe has collapsed.
107
+ This includes longitudinal cracks, circumferential breaks, and complete structural failures that compromise the integrity of the sewer system.
108
+ 4b)Surface Damage: Detect areas of the pipe's interior that exhibit signs of wear, erosion, or damage on the surface.
109
+ This includes minor scratches, pitting, scaling, or any form of deterioration that affects the pipe's surface but does not necessarily penetrate deeply into the structure.
110
+ 4c) Production Error: Identify defects that originated during the pipe's manufacturing process, such as inconsistent pipe thickness, improper joint alignment, or material imperfections.
111
+ These are flaws that were introduced before installation and could potentially affect the pipe's performance or longevity.
112
+ 4d) Deformations: Recognize any alterations in the shape of the pipe, such as bending, sagging, or bulging, that indicate a deformation.
113
+ This includes both minor deformations that may affect flow efficiency and major deformations that threaten the pipe's structural integrity.
114
+ 4e) Roots: Detect the presence of roots infiltrating the sewer pipe, whether through joints, cracks, or other vulnerabilities.
115
+ This involves identifying both the initial stages of root intrusion and the more advanced stages where roots have significantly obstructed the pipe.
116
+ 5) Additional considerations while analyzing the images: do not consider blurred text or user-defined circled areas in the images.
117
+ 6) You will always try to describe the image that you see.
118
+ You must provide your output in JSON format with DESCRIPTION: <your description of the image>, PREDICTION: <your prediction, either DEFECTIVE or NON DEFECTIVE>"""
119
+ )
120
+ with gr.Accordion("Basic prompt used for GPT4-V"):
121
+ gr.Markdown("""
122
+ You are a virtual sewer technician with the capability to analyze images from CCTV cameras taken inside sewer pipes.
123
+ Your task is to examine each image and provide a concise, yet accurate, summary for retrieval.
124
+ After summarizing, you must classify the image as DEFECTIVE or NON DEFECTIVE.
125
+ You will always try to describe the image that you see.
126
+ You must provide your output in JSON format with DESCRIPTION: <your description of the image>, PREDICTION: <your prediction, either DEFECTIVE or NON DEFECTIVE>"""
127
+ )
128
+
129
 
130
  prev_btn.click(fn=return_prev, inputs=index, outputs=[index, txt_item, img_out,
131
  txt_out_GPT4, txt_out_GPT4s,