Dave67350 commited on
Commit
909c638
·
verified ·
1 Parent(s): c14df9d

Update tools/ai_technical_doc.py

Browse files
Files changed (1) hide show
  1. tools/ai_technical_doc.py +5 -3
tools/ai_technical_doc.py CHANGED
@@ -69,8 +69,8 @@ QUESTIONS = [
69
  def get_questions():
70
  return QUESTIONS
71
 
72
- # === Optional: Run the tool standalone for debugging ===
73
  def run_tool():
 
74
  state = {"step": 0, "answers": {}}
75
 
76
  def step_by_step_agent(user_input, state):
@@ -91,11 +91,11 @@ def run_tool():
91
  pdf_path = export_text_to_pdf(content, language=detected_lang)
92
  return "✅ Completed. Download your documentation below.", {"done": True}, pdf_path
93
 
94
- with gr.Blocks() as demo:
95
  chatbot = gr.Chatbot(label="🧠 Technical Doc Assistant", value=[{"role": "assistant", "content": QUESTIONS[0][1]}], type="messages")
96
  msg = gr.Textbox(label="Your answer")
97
  state_var = gr.State(state)
98
- file_output = gr.File(label="Download PDF")
99
  reset_btn = gr.Button("🔁 Restart")
100
 
101
  def chat_logic(msg_in, state_in):
@@ -110,3 +110,5 @@ def run_tool():
110
 
111
  msg.submit(chat_logic, [msg, state_var], [chatbot, state_var, file_output])
112
  reset_btn.click(reset, outputs=[chatbot, state_var, file_output])
 
 
 
69
  def get_questions():
70
  return QUESTIONS
71
 
 
72
  def run_tool():
73
+ import gradio as gr
74
  state = {"step": 0, "answers": {}}
75
 
76
  def step_by_step_agent(user_input, state):
 
91
  pdf_path = export_text_to_pdf(content, language=detected_lang)
92
  return "✅ Completed. Download your documentation below.", {"done": True}, pdf_path
93
 
94
+ with gr.Blocks(title="AI Technical Documentation Tool") as demo:
95
  chatbot = gr.Chatbot(label="🧠 Technical Doc Assistant", value=[{"role": "assistant", "content": QUESTIONS[0][1]}], type="messages")
96
  msg = gr.Textbox(label="Your answer")
97
  state_var = gr.State(state)
98
+ file_output = gr.File(label="Download PDF", visible=True)
99
  reset_btn = gr.Button("🔁 Restart")
100
 
101
  def chat_logic(msg_in, state_in):
 
110
 
111
  msg.submit(chat_logic, [msg, state_var], [chatbot, state_var, file_output])
112
  reset_btn.click(reset, outputs=[chatbot, state_var, file_output])
113
+
114
+ demo.launch()