Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 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 |
|