Spaces:
Runtime error
Runtime error
Clear cache on inference failure
Browse files- sketch2diagram.py +6 -1
sketch2diagram.py
CHANGED
|
@@ -50,7 +50,12 @@ if input_file is not None:
|
|
| 50 |
# Run model inference
|
| 51 |
if generate_command:
|
| 52 |
with st.spinner("Generating TikZ code..."):
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
pdf_file_path = compile_tikz_to_pdf(output)
|
| 55 |
if output and pdf_file_path:
|
| 56 |
st.subheader("Generated TikZ Code")
|
|
|
|
| 50 |
# Run model inference
|
| 51 |
if generate_command:
|
| 52 |
with st.spinner("Generating TikZ code..."):
|
| 53 |
+
try:
|
| 54 |
+
output = run_inference(input_file, model_name, args)[0]
|
| 55 |
+
except Exception as e:
|
| 56 |
+
st.error(f"Inference failed: {e}")
|
| 57 |
+
st.session_state.clear()
|
| 58 |
+
return
|
| 59 |
pdf_file_path = compile_tikz_to_pdf(output)
|
| 60 |
if output and pdf_file_path:
|
| 61 |
st.subheader("Generated TikZ Code")
|