Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -252,6 +252,7 @@ def rag_pipeline(query: str):
|
|
| 252 |
# Unified QA System
|
| 253 |
# -------------------------------
|
| 254 |
def qa_system(method, question):
|
|
|
|
| 255 |
if method == "Retrieval-Augmented Generation (RAG)":
|
| 256 |
answer, confidence, elapsed = rag_pipeline(question)
|
| 257 |
return f"**Method:** RAG-based Model", confidence, f"{elapsed} seconds", answer
|
|
@@ -264,7 +265,9 @@ def qa_system(method, question):
|
|
| 264 |
temperature=0.7, do_sample=True,
|
| 265 |
pad_token_id=tokenizer.eos_token_id)
|
| 266 |
answer = tokenizer.decode(outputs[0], skip_special_tokens=True).split("Answer:")[-1].strip()
|
| 267 |
-
|
|
|
|
|
|
|
| 268 |
|
| 269 |
# -------------------------------
|
| 270 |
# Gradio UI (same as before)
|
|
|
|
| 252 |
# Unified QA System
|
| 253 |
# -------------------------------
|
| 254 |
def qa_system(method, question):
|
| 255 |
+
start_time = time.time()
|
| 256 |
if method == "Retrieval-Augmented Generation (RAG)":
|
| 257 |
answer, confidence, elapsed = rag_pipeline(question)
|
| 258 |
return f"**Method:** RAG-based Model", confidence, f"{elapsed} seconds", answer
|
|
|
|
| 265 |
temperature=0.7, do_sample=True,
|
| 266 |
pad_token_id=tokenizer.eos_token_id)
|
| 267 |
answer = tokenizer.decode(outputs[0], skip_special_tokens=True).split("Answer:")[-1].strip()
|
| 268 |
+
end_time = time.time()
|
| 269 |
+
response_time = round(end_time - start_time, 2)
|
| 270 |
+
return f"**Method:** Fine-Tuned Model", 0.95, response_time, answer
|
| 271 |
|
| 272 |
# -------------------------------
|
| 273 |
# Gradio UI (same as before)
|