mughal-88 commited on
Commit
013f626
·
verified ·
1 Parent(s): 861e970

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -7
app.py CHANGED
@@ -5,9 +5,18 @@ import requests
5
  # Replace with your actual Groq API endpoint URL
6
  GROQ_API_URL = "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"
7
 
 
8
  def process_model(model_path):
9
  # Load the 3D model using trimesh
10
- mesh = trimesh.load(model_path)
 
 
 
 
 
 
 
 
11
 
12
  # Extract features (replace with relevant features for material estimation)
13
  features = {
@@ -31,19 +40,18 @@ def process_model(model_path):
31
  st.error(error_message)
32
  return None
33
 
 
34
  def main():
35
- st.title("QUICK Cad Model Analyzer App")
36
 
37
- uploaded_file = st.file_uploader("Upload 3D CAD Model (Supported formats: .stl, .obj, etc.)")
38
 
39
  if uploaded_file is not None:
40
  model_path = uploaded_file.name
41
  else:
42
- st.stop()
43
 
44
- sheet_length = st.number_input("Steel Sheet Length (mm)", min_value=0.0)
45
- sheet_width = st.number_input("Steel Sheet Width (mm)", min_value=0.0)
46
- quantity = st.number_input("Quantity to Manufacture", min_value=1)
47
 
48
  if st.button("Estimate Material Requirements"):
49
  if model_path:
@@ -51,5 +59,6 @@ def main():
51
  if material_requirements:
52
  st.success(f"Estimated Material Requirements:\n{material_requirements}")
53
 
 
54
  if __name__ == "__main__":
55
  main()
 
5
  # Replace with your actual Groq API endpoint URL
6
  GROQ_API_URL = "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"
7
 
8
+
9
  def process_model(model_path):
10
  # Load the 3D model using trimesh
11
+ try:
12
+ mesh = trimesh.load(model_path)
13
+ except FileNotFoundError:
14
+ st.error(f"Error: File not found at path '{model_path}'.")
15
+ return None
16
+ except (trimesh.exceptions.ImportError, ValueError) as e:
17
+ # Handle potential format-specific errors (e.g., STEP format issues)
18
+ st.error(f"Error loading model: {e}")
19
+ return None
20
 
21
  # Extract features (replace with relevant features for material estimation)
22
  features = {
 
40
  st.error(error_message)
41
  return None
42
 
43
+
44
  def main():
45
+ st.title("RAG-based Material Estimation App (Groq API)")
46
 
47
+ uploaded_file = st.file_uploader("Upload 3D CAD Model (Supported formats: .stl, .obj, .stp, etc.)")
48
 
49
  if uploaded_file is not None:
50
  model_path = uploaded_file.name
51
  else:
52
+ model_path = None # Set model_path to None if no file is uploaded
53
 
54
+ # ... (rest of your code for sheet dimensions and quantity)
 
 
55
 
56
  if st.button("Estimate Material Requirements"):
57
  if model_path:
 
59
  if material_requirements:
60
  st.success(f"Estimated Material Requirements:\n{material_requirements}")
61
 
62
+
63
  if __name__ == "__main__":
64
  main()