m7mdal7aj commited on
Commit
9434757
1 Parent(s): 6f1c42e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -12
app.py CHANGED
@@ -92,7 +92,7 @@ def image_qa_app(kbvqa):
92
  st.session_state['answer_in_progress'] = True
93
  answer = answer_question(st.session_state['processed_image'], question, model=kbvqa)
94
  st.session_state['qa_history'].append((question, answer))
95
- st.session_state['question'] = ''
96
 
97
  # Display all Q&A
98
  for q, a in st.session_state['qa_history']:
@@ -117,17 +117,7 @@ def run_inference():
117
  index=0 # Default to the first option
118
  )
119
 
120
- # Set default confidence based on the selected model
121
- default_confidence = 0.2 if detection_model == "yolov5" else 0.4
122
 
123
- # Slider for confidence level
124
- confidence_level = st.slider(
125
- "Select Detection Confidence Level",
126
- min_value=0.1,
127
- max_value=0.9,
128
- value=default_confidence,
129
- step=0.1
130
- )
131
 
132
 
133
 
@@ -152,7 +142,22 @@ def run_inference():
152
  image_qa_app(st.session_state['kbvqa'])
153
 
154
  else:
155
- st.write('Model is not ready for inference yet')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
 
158
  # Main function
 
92
  st.session_state['answer_in_progress'] = True
93
  answer = answer_question(st.session_state['processed_image'], question, model=kbvqa)
94
  st.session_state['qa_history'].append((question, answer))
95
+
96
 
97
  # Display all Q&A
98
  for q, a in st.session_state['qa_history']:
 
117
  index=0 # Default to the first option
118
  )
119
 
 
 
120
 
 
 
 
 
 
 
 
 
121
 
122
 
123
 
 
142
  image_qa_app(st.session_state['kbvqa'])
143
 
144
  else:
145
+ st.write(f'{method} model is not ready for inference yet')
146
+
147
+
148
+ # Set default confidence based on the selected model
149
+ default_confidence = 0.2 if detection_model == "yolov5" else 0.4
150
+
151
+ # Slider for confidence level
152
+ confidence_level = st.slider(
153
+ "Select Detection Confidence Level",
154
+ min_value=0.1,
155
+ max_value=0.9,
156
+ value=default_confidence,
157
+ step=0.1
158
+ )
159
+
160
+ st.session_state['kbvqa'].detection_confidence = confidence_level
161
 
162
 
163
  # Main function