spandana30 commited on
Commit
a7524b6
Β·
verified Β·
1 Parent(s): 50e0854

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -66,8 +66,9 @@ def call_model(prompt: str, max_retries=3) -> str:
66
  return_full_text=False
67
  )
68
  except Exception as e:
69
- st.error(f"Model call failed (attempt {attempt+1}): {e}")
70
- time.sleep(2)
 
71
  return "<html><body><h1>Error generating UI</h1></body></html>"
72
 
73
  def time_agent(agent_func, state: AgentState, label: str):
@@ -134,6 +135,8 @@ def main():
134
  with st.sidebar:
135
  max_iter = st.slider("Max QA Iterations", 1, 5, 2)
136
 
 
 
137
  prompt = st.text_area("πŸ“ Describe the UI you want:", "A coffee shop landing page with hero, menu, and contact form.", height=150)
138
 
139
  if st.button("πŸš€ Generate UI"):
@@ -169,4 +172,4 @@ def main():
169
  st.write(f"πŸ€– {stage.title().replace('_', ' ')} Time: {final_state['timings'].get(stage, 0):.2f}s")
170
 
171
  if __name__ == "__main__":
172
- main()
 
66
  return_full_text=False
67
  )
68
  except Exception as e:
69
+ st.error(f"Model call failed (attempt {attempt+1}): {str(e)}")
70
+ st.write("\n\n**Full Error:**", e)
71
+ st.stop() # Force exit to show error
72
  return "<html><body><h1>Error generating UI</h1></body></html>"
73
 
74
  def time_agent(agent_func, state: AgentState, label: str):
 
135
  with st.sidebar:
136
  max_iter = st.slider("Max QA Iterations", 1, 5, 2)
137
 
138
+ st.write("\nπŸ” HF_TOKEN found:", st.secrets.get("HF_TOKEN", "❌ Missing!"))
139
+
140
  prompt = st.text_area("πŸ“ Describe the UI you want:", "A coffee shop landing page with hero, menu, and contact form.", height=150)
141
 
142
  if st.button("πŸš€ Generate UI"):
 
172
  st.write(f"πŸ€– {stage.title().replace('_', ' ')} Time: {final_state['timings'].get(stage, 0):.2f}s")
173
 
174
  if __name__ == "__main__":
175
+ main()