ramysaidagieb commited on
Commit
eb1a7ba
·
verified ·
1 Parent(s): 04b66a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -1,16 +1,21 @@
1
  import gradio as gr
2
  from rag_pipeline import load_rag_chain
3
 
 
4
  rag_chain = load_rag_chain()
5
 
 
6
  def ask_question(query):
7
  result = rag_chain.invoke(query)
8
  return result['result']
9
 
10
- iface = gr.Interface(fn=ask_question,
11
- inputs=gr.Textbox(lines=3, label="Ask a Question"),
12
- outputs="text",
13
- title="Custom PDF RAG Chatbot")
 
 
 
14
 
15
  if __name__ == "__main__":
16
- iface.launch()
 
1
  import gradio as gr
2
  from rag_pipeline import load_rag_chain
3
 
4
+ # Load the RAG chain once
5
  rag_chain = load_rag_chain()
6
 
7
+ # Gradio interface
8
  def ask_question(query):
9
  result = rag_chain.invoke(query)
10
  return result['result']
11
 
12
+ iface = gr.Interface(
13
+ fn=ask_question,
14
+ inputs=gr.Textbox(lines=3, placeholder="Ask something from your PDF...", label="Your Question"),
15
+ outputs="text",
16
+ title="🧠 Custom PDF Chatbot (Hugging Face)",
17
+ description="Ask questions from your own uploaded PDF data."
18
+ )
19
 
20
  if __name__ == "__main__":
21
+ iface.launch()