Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -117,12 +117,7 @@ def run_inference():
|
|
| 117 |
index=0 # Default to the first option
|
| 118 |
)
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
# Initialize session state for the model
|
| 125 |
-
|
| 126 |
if method == "Fine-Tuned Model":
|
| 127 |
if 'kbvqa' not in st.session_state:
|
| 128 |
st.session_state['kbvqa'] = None
|
|
@@ -137,28 +132,23 @@ def run_inference():
|
|
| 137 |
|
| 138 |
if st.session_state['kbvqa']:
|
| 139 |
st.write("Model is ready for inference.")
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
if st.session_state['kbvqa']:
|
| 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 |
-
if st.session_state['kbvqa']:
|
| 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
|
| 164 |
def main():
|
|
|
|
| 117 |
index=0 # Default to the first option
|
| 118 |
)
|
| 119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
# Initialize session state for the model
|
|
|
|
| 121 |
if method == "Fine-Tuned Model":
|
| 122 |
if 'kbvqa' not in st.session_state:
|
| 123 |
st.session_state['kbvqa'] = None
|
|
|
|
| 132 |
|
| 133 |
if st.session_state['kbvqa']:
|
| 134 |
st.write("Model is ready for inference.")
|
| 135 |
+
# Set default confidence based on the selected model
|
| 136 |
+
default_confidence = 0.2 if detection_model == "yolov5" else 0.4
|
| 137 |
+
# Slider for confidence level
|
| 138 |
+
confidence_level = st.slider(
|
| 139 |
+
"Select Detection Confidence Level",
|
| 140 |
+
min_value=0.1,
|
| 141 |
+
max_value=0.9,
|
| 142 |
+
value=default_confidence,
|
| 143 |
+
step=0.1
|
| 144 |
+
)
|
| 145 |
+
st.session_state['kbvqa'].detection_confidence = confidence_level
|
| 146 |
+
|
| 147 |
if st.session_state['kbvqa']:
|
| 148 |
image_qa_app(st.session_state['kbvqa'])
|
| 149 |
|
| 150 |
else:
|
| 151 |
st.write(f'{method} model is not ready for inference yet')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
# Main function
|
| 154 |
def main():
|