MrSimple07 commited on
Commit
5729662
·
1 Parent(s): 64543ac

content = format_table_content fixed

Browse files
Files changed (1) hide show
  1. app.py +11 -18
app.py CHANGED
@@ -57,30 +57,28 @@ def ask_question(question):
57
  answer, sources = answer_question(question, query_engine, reranker)
58
 
59
  return answer, sources
60
-
61
  def create_interface():
62
  """Create Gradio UI"""
 
 
 
63
  with gr.Blocks(title="AIEXP - RAG System", theme=gr.themes.Soft()) as demo:
64
  gr.Markdown("""
65
  # AIEXP - AI Expert для нормативной документации
66
  ## Упрощенная версия RAG системы
67
  """)
68
-
69
- with gr.Row():
70
- init_btn = gr.Button("Инициализировать систему", variant="primary")
71
- status = gr.Textbox(label="Статус", value="Не инициализирована")
72
-
73
  gr.Markdown("### Задайте вопрос")
74
-
75
  with gr.Row():
76
  question = gr.Textbox(
77
  label="Ваш вопрос",
78
  placeholder="Введите вопрос...",
79
  lines=3
80
  )
81
-
82
  ask_btn = gr.Button("Найти ответ", variant="primary")
83
-
84
  gr.Examples(
85
  examples=[
86
  "О чем таблица А.12 в ГОСТ Р 59023.4-2020?",
@@ -89,7 +87,7 @@ def create_interface():
89
  ],
90
  inputs=question
91
  )
92
-
93
  with gr.Row():
94
  answer = gr.Textbox(
95
  label="Ответ",
@@ -99,25 +97,20 @@ def create_interface():
99
  label="Источники",
100
  lines=10
101
  )
102
-
103
  # Event handlers
104
- init_btn.click(
105
- fn=initialize_system,
106
- outputs=status
107
- )
108
-
109
  ask_btn.click(
110
  fn=ask_question,
111
  inputs=question,
112
  outputs=[answer, sources]
113
  )
114
-
115
  question.submit(
116
  fn=ask_question,
117
  inputs=question,
118
  outputs=[answer, sources]
119
  )
120
-
121
  return demo
122
 
123
  if __name__ == "__main__":
 
57
  answer, sources = answer_question(question, query_engine, reranker)
58
 
59
  return answer, sources
 
60
  def create_interface():
61
  """Create Gradio UI"""
62
+ # Auto-initialize system before UI starts
63
+ status_msg = initialize_system()
64
+
65
  with gr.Blocks(title="AIEXP - RAG System", theme=gr.themes.Soft()) as demo:
66
  gr.Markdown("""
67
  # AIEXP - AI Expert для нормативной документации
68
  ## Упрощенная версия RAG системы
69
  """)
70
+
 
 
 
 
71
  gr.Markdown("### Задайте вопрос")
72
+
73
  with gr.Row():
74
  question = gr.Textbox(
75
  label="Ваш вопрос",
76
  placeholder="Введите вопрос...",
77
  lines=3
78
  )
79
+
80
  ask_btn = gr.Button("Найти ответ", variant="primary")
81
+
82
  gr.Examples(
83
  examples=[
84
  "О чем таблица А.12 в ГОСТ Р 59023.4-2020?",
 
87
  ],
88
  inputs=question
89
  )
90
+
91
  with gr.Row():
92
  answer = gr.Textbox(
93
  label="Ответ",
 
97
  label="Источники",
98
  lines=10
99
  )
100
+
101
  # Event handlers
 
 
 
 
 
102
  ask_btn.click(
103
  fn=ask_question,
104
  inputs=question,
105
  outputs=[answer, sources]
106
  )
107
+
108
  question.submit(
109
  fn=ask_question,
110
  inputs=question,
111
  outputs=[answer, sources]
112
  )
113
+
114
  return demo
115
 
116
  if __name__ == "__main__":