tarujain8 commited on
Commit
8bc63d1
·
1 Parent(s): 13f6834

feat: initialize FastAPI backend and Streamlit frontend for relationship analysis service

Browse files
Files changed (3) hide show
  1. .streamlit/config.toml +7 -0
  2. backend/app.py +2 -0
  3. frontend/app.py +6 -3
.streamlit/config.toml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [server]
2
+ enableCORS = false
3
+ enableXsrfProtection = false
4
+ maxUploadSize = 100
5
+
6
+ [browser]
7
+ gatherUsageStats = false
backend/app.py CHANGED
@@ -47,7 +47,9 @@ async def detect_perspective_route(
47
  feelings: str = Form(""),
48
  files: List[UploadFile] = File(default=[]),
49
  ):
 
50
  try:
 
51
  # Save temp files and extract OCR
52
  image_paths = []
53
  for file in files:
 
47
  feelings: str = Form(""),
48
  files: List[UploadFile] = File(default=[]),
49
  ):
50
+ logger.info(f"Detect perspective called. Files: {len(files)}, Chat length: {len(chat)}, Feelings length: {len(feelings)}")
51
  try:
52
+
53
  # Save temp files and extract OCR
54
  image_paths = []
55
  for file in files:
frontend/app.py CHANGED
@@ -395,11 +395,14 @@ if st.session_state.get("run_analysis"):
395
 
396
  st.session_state["analysis_payload"] = payload.get("analysis", {})
397
  st.session_state["analysis_raw"] = payload.get("raw", {})
398
- st.session_state["draft_chat"] = chat
399
- st.session_state["draft_feelings"] = feelings
 
 
400
 
401
  loading_placeholder.empty()
402
  st.switch_page("pages/results.py")
403
  except Exception as e:
404
  loading_placeholder.empty()
405
- st.error(f"Velra encountered an issue connecting to the engine. Ensure backend is running. Details: {e}")
 
 
395
 
396
  st.session_state["analysis_payload"] = payload.get("analysis", {})
397
  st.session_state["analysis_raw"] = payload.get("raw", {})
398
+
399
+ # Save the actual text used for analysis to drafts
400
+ st.session_state["draft_chat"] = analysis_chat
401
+ st.session_state["draft_feelings"] = analysis_feelings
402
 
403
  loading_placeholder.empty()
404
  st.switch_page("pages/results.py")
405
  except Exception as e:
406
  loading_placeholder.empty()
407
+ st.error(f"Velra encountered an issue connecting to the engine. Details: {e}")
408
+