Abhiroopvanaone commited on
Commit
dbfa293
Β·
verified Β·
1 Parent(s): feccca5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -3,18 +3,17 @@ import gradio as gr
3
  import torch
4
  from transformers import pipeline
5
  from PIL import Image
6
- import traceback
7
 
8
  # Global model storage
9
  models = {}
10
 
11
  @spaces.GPU(duration=120)
12
  def generate_code(image, model_choice, prompt_style):
13
- """Generate CADQuery code - single GPU function."""
14
  if image is None:
15
  return "❌ Please upload an image first."
16
 
17
- # Create prompts
18
  prompts = {
19
  "Simple": "Generate CADQuery Python code for this 3D model:",
20
  "Detailed": "Analyze this 3D CAD model and generate Python CADQuery code.\n\nRequirements:\n- Import cadquery as cq\n- Store result in 'result' variable\n- Use proper CADQuery syntax\n\nCode:",
@@ -93,7 +92,7 @@ python your_script.py
93
  return f"❌ **Generation Failed**: {str(e)[:500]}"
94
 
95
  def system_info():
96
- """Get system info - no GPU needed."""
97
  info = f"""## πŸ–₯️ System Information
98
 
99
  - **CUDA Available**: {torch.cuda.is_available()}
@@ -148,5 +147,4 @@ with gr.Blocks(title="GLM-4.5V CAD Generator", theme=gr.themes.Soft()) as demo:
148
  if __name__ == "__main__":
149
  print("πŸš€ Starting GLM-4.5V CAD Generator...")
150
  print(f"CUDA available: {torch.cuda.is_available()}")
151
- # Remove share=True for HF Spaces
152
- demo.launch()
 
3
  import torch
4
  from transformers import pipeline
5
  from PIL import Image
 
6
 
7
  # Global model storage
8
  models = {}
9
 
10
  @spaces.GPU(duration=120)
11
  def generate_code(image, model_choice, prompt_style):
12
+ """Generate CADQuery code from image."""
13
  if image is None:
14
  return "❌ Please upload an image first."
15
 
16
+ # Prompts
17
  prompts = {
18
  "Simple": "Generate CADQuery Python code for this 3D model:",
19
  "Detailed": "Analyze this 3D CAD model and generate Python CADQuery code.\n\nRequirements:\n- Import cadquery as cq\n- Store result in 'result' variable\n- Use proper CADQuery syntax\n\nCode:",
 
92
  return f"❌ **Generation Failed**: {str(e)[:500]}"
93
 
94
  def system_info():
95
+ """Get system info."""
96
  info = f"""## πŸ–₯️ System Information
97
 
98
  - **CUDA Available**: {torch.cuda.is_available()}
 
147
  if __name__ == "__main__":
148
  print("πŸš€ Starting GLM-4.5V CAD Generator...")
149
  print(f"CUDA available: {torch.cuda.is_available()}")
150
+ demo.launch() # NO share=True!