Spaces:
Sleeping
Sleeping
Update app.py
Browse filesquestion answer the in file name to extrect data
app.py
CHANGED
|
@@ -90,15 +90,13 @@ def generate_qa(token):
|
|
| 90 |
# ✅ Ask a question using token
|
| 91 |
def ask_question(token, question):
|
| 92 |
try:
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
cursor.execute("SELECT chunk_data FROM token_data WHERE token_id = ?", (token,))
|
| 96 |
-
row = cursor.fetchone()
|
| 97 |
|
| 98 |
if not row:
|
| 99 |
return "❌ Token not found."
|
| 100 |
|
| 101 |
-
chunks = json.loads(row[
|
| 102 |
processor = pdf_query()
|
| 103 |
model = processor.model
|
| 104 |
|
|
|
|
| 90 |
# ✅ Ask a question using token
|
| 91 |
def ask_question(token, question):
|
| 92 |
try:
|
| 93 |
+
|
| 94 |
+
row=create_db.fetch_by_token_or_filename(token)
|
|
|
|
|
|
|
| 95 |
|
| 96 |
if not row:
|
| 97 |
return "❌ Token not found."
|
| 98 |
|
| 99 |
+
chunks = json.loads(row['chunk_data'])
|
| 100 |
processor = pdf_query()
|
| 101 |
model = processor.model
|
| 102 |
|