João Lima commited on
Commit
39e8d67
·
1 Parent(s): 5f50a9b

updating requeriments

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  from ingestion.pdf import process_pdf
3
  from rag.pipeline import run_rag
4
- import os
5
 
6
  vectorstore = None
7
 
@@ -17,13 +16,13 @@ def load_document(file):
17
 
18
  def ask(question):
19
  if vectorstore is None:
20
- return "Upload a document first", "", ""
21
  if not question.strip():
22
- return "Please enter a question", "", ""
23
  try:
24
  return run_rag(question, vectorstore)
25
  except Exception as e:
26
- return f"Error: {str(e)}", "", ""
27
 
28
  with gr.Blocks(title="Tech Explainer RAG") as demo:
29
  gr.Markdown("# Tech Explainer — RAG with Automatic Evaluation")
@@ -44,4 +43,10 @@ with gr.Blocks(title="Tech Explainer RAG") as demo:
44
  load_btn.click(load_document, inputs=file, outputs=status)
45
  ask_btn.click(ask, inputs=question, outputs=[answer, sources, evaluation])
46
 
47
- demo.launch(share=True, auth=("username", "password"), ssr_mode=False)
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from ingestion.pdf import process_pdf
3
  from rag.pipeline import run_rag
 
4
 
5
  vectorstore = None
6
 
 
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(
47
+ share=False,
48
+ server_name="0.0.0.0",
49
+ server_port=7860,
50
+ show_error=True,
51
+ quiet=False
52
+ )