dewiri commited on
Commit
248aab3
·
verified ·
1 Parent(s): 62d04b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -1,16 +1,21 @@
1
-
2
  import gradio as gr
3
- from your_rag_code import run_qa_pipeline # deine Funktion importieren
4
 
5
  def answer_question(query):
6
- return run_qa_pipeline(query, k=5)
 
 
 
 
7
 
8
  iface = gr.Interface(
9
  fn=answer_question,
10
- inputs=gr.Textbox(label="Stelle eine Frage zu Catan"),
11
  outputs="text",
12
- title="Catan Regel-Experte",
13
- description="Stelle Fragen zu den Regeln von Catan. Z.B. 'Welche Zahlen sind am besten?'"
 
14
  )
15
 
16
- iface.launch()
 
 
 
1
  import gradio as gr
2
+ from rag_pipeline import run_qa_pipeline
3
 
4
  def answer_question(query):
5
+ try:
6
+ answer = run_qa_pipeline(query)
7
+ return answer
8
+ except Exception as e:
9
+ return f"Fehler: {str(e)}"
10
 
11
  iface = gr.Interface(
12
  fn=answer_question,
13
+ inputs=gr.Textbox(label="Stelle deine Frage zu Catan", placeholder="z.B. Welche Zahl ist am besten?"),
14
  outputs="text",
15
+ title="🧠 Catan Regel-Experte (RAG)",
16
+ description="Frage etwas zu den Catan-Regeln. Die App durchsucht echte PDF-Regeln und gibt eine Antwort basierend auf dem Dokumentinhalt.",
17
+ allow_flagging="never"
18
  )
19
 
20
+ if __name__ == "__main__":
21
+ iface.launch()