Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -177,20 +177,24 @@ def prediction(image_id_main, local_image_path, model_path):
|
|
177 |
results_list.append(result)
|
178 |
|
179 |
submission_det = pd.DataFrame(results_list, columns=['image_id', 'PredictionString'])
|
180 |
-
|
181 |
-
|
|
|
|
|
182 |
|
183 |
@app.route('/predict', methods=['POST'])
|
184 |
def predict():
|
185 |
-
image_file = request.files['image']
|
186 |
image_id = request.form['image_id']
|
|
|
187 |
model_path = request.form['model_path']
|
188 |
-
|
189 |
-
local_image_path = os.path.join("
|
|
|
190 |
image_file.save(local_image_path)
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
194 |
|
195 |
if __name__ == '__main__':
|
196 |
app.run(host='0.0.0.0', port=8000)
|
|
|
177 |
results_list.append(result)
|
178 |
|
179 |
submission_det = pd.DataFrame(results_list, columns=['image_id', 'PredictionString'])
|
180 |
+
submission_det_path = os.path.join(outdir, "submission_det.csv")
|
181 |
+
submission_det.to_csv(submission_det_path, index=False)
|
182 |
+
|
183 |
+
return submission_det_path
|
184 |
|
185 |
@app.route('/predict', methods=['POST'])
|
186 |
def predict():
|
|
|
187 |
image_id = request.form['image_id']
|
188 |
+
image_file = request.files['image']
|
189 |
model_path = request.form['model_path']
|
190 |
+
|
191 |
+
local_image_path = os.path.join("input_images", image_file.filename)
|
192 |
+
os.makedirs("input_images", exist_ok=True)
|
193 |
image_file.save(local_image_path)
|
194 |
+
|
195 |
+
submission_det_path = prediction(image_id, local_image_path, model_path)
|
196 |
+
|
197 |
+
return send_file(submission_det_path, as_attachment=True)
|
198 |
|
199 |
if __name__ == '__main__':
|
200 |
app.run(host='0.0.0.0', port=8000)
|