Spaces:
Sleeping
Sleeping
João Lima
commited on
Commit
·
7b96de5
1
Parent(s):
9d1ba3e
creating init files
Browse files- app.py +4 -5
- evaluation/__init__.py +0 -0
- ingestion/__init__.py +0 -0
- rag/__init__.py +0 -0
app.py
CHANGED
|
@@ -16,13 +16,13 @@ def load_document(file):
|
|
| 16 |
|
| 17 |
def ask(question):
|
| 18 |
if vectorstore is None:
|
| 19 |
-
return "Upload a document", "", ""
|
| 20 |
if not question.strip():
|
| 21 |
-
return "
|
| 22 |
try:
|
| 23 |
return run_rag(question, vectorstore)
|
| 24 |
except Exception as e:
|
| 25 |
-
return f"Error: {str(e)}", "", ""
|
| 26 |
|
| 27 |
with gr.Blocks(title="Tech Explainer RAG") as demo:
|
| 28 |
gr.Markdown("# Tech Explainer — RAG with Automatic Evaluation")
|
|
@@ -43,5 +43,4 @@ with gr.Blocks(title="Tech Explainer RAG") as demo:
|
|
| 43 |
load_btn.click(load_document, inputs=file, outputs=status)
|
| 44 |
ask_btn.click(ask, inputs=question, outputs=[answer, sources, evaluation])
|
| 45 |
|
| 46 |
-
|
| 47 |
-
demo.queue().launch()
|
|
|
|
| 16 |
|
| 17 |
def ask(question):
|
| 18 |
if vectorstore is None:
|
| 19 |
+
return "⚠ Upload a document first", "", ""
|
| 20 |
if not question.strip():
|
| 21 |
+
return "⚠ Please enter a question", "", ""
|
| 22 |
try:
|
| 23 |
return run_rag(question, vectorstore)
|
| 24 |
except Exception as e:
|
| 25 |
+
return f"❌ Error: {str(e)}", "", ""
|
| 26 |
|
| 27 |
with gr.Blocks(title="Tech Explainer RAG") as demo:
|
| 28 |
gr.Markdown("# Tech Explainer — RAG with Automatic Evaluation")
|
|
|
|
| 43 |
load_btn.click(load_document, inputs=file, outputs=status)
|
| 44 |
ask_btn.click(ask, inputs=question, outputs=[answer, sources, evaluation])
|
| 45 |
|
| 46 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
evaluation/__init__.py
ADDED
|
File without changes
|
ingestion/__init__.py
ADDED
|
File without changes
|
rag/__init__.py
ADDED
|
File without changes
|