Harishkhawaja commited on
Commit
6c39f70
·
verified ·
1 Parent(s): 2be46a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -66,15 +66,14 @@ def process_text(input_text):
66
 
67
  # === Core RAG Handler ===
68
  def handle_input(file, clipboard, query):
69
- try:
70
- raw_text = extract_text(file, clipboard)
71
- if not raw_text or raw_text.strip() == "":
72
- return "⚠️ Please provide either a PDF or some clipboard text."
73
-
74
- qa = process_text(raw_text)
75
- prompt = query if query else "Summarize the key points and user-facing risks in this policy."
76
- result = qa.run(prompt)
77
- return result
78
  except Exception as e:
79
  return f"❌ Error: {str(e)}"
80
 
 
66
 
67
  # === Core RAG Handler ===
68
  def handle_input(file, clipboard, query):
69
+ raw_text = extract_text(file, clipboard)
70
+ if not raw_text:
71
+ return "Please provide either a PDF or clipboard text."
72
+
73
+ qa = process_text(raw_text)
74
+ response = qa.invoke({"query": query if query else "Summarize the key points and risks in this policy."})
75
+ result = response["result"]
76
+ return result
 
77
  except Exception as e:
78
  return f"❌ Error: {str(e)}"
79