NaimaAqeel commited on
Commit
22de3ff
Β·
verified Β·
1 Parent(s): 988505b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -45,11 +45,12 @@ def ask_question(file, question, history):
45
  history.append((question, answer))
46
  return "", history
47
 
48
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
49
  gr.Markdown("## πŸ“„ Document QA with Smart Retrieval")
50
 
51
- with gr.Group():
52
- with gr.Box():
 
53
  gr.Markdown("### πŸ”½ Upload Your File")
54
  file_input = gr.File(
55
  label="Choose a PDF or Word file",
@@ -58,9 +59,13 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
58
  )
59
 
60
  chatbot = gr.Chatbot(label="πŸ’¬ Chat with Document")
61
- question = gr.Textbox(label="Ask your question", placeholder="Type your question here...")
 
 
 
62
  state = gr.State([])
63
 
 
64
  question.submit(ask_question, [file_input, question, state], [question, chatbot])
65
 
66
  demo.launch()
 
45
  history.append((question, answer))
46
  return "", history
47
 
48
+ with gr.Blocks() as demo:
49
  gr.Markdown("## πŸ“„ Document QA with Smart Retrieval")
50
 
51
+ # File upload styled like a dialogue box
52
+ with gr.Row():
53
+ with gr.Column():
54
  gr.Markdown("### πŸ”½ Upload Your File")
55
  file_input = gr.File(
56
  label="Choose a PDF or Word file",
 
59
  )
60
 
61
  chatbot = gr.Chatbot(label="πŸ’¬ Chat with Document")
62
+ question = gr.Textbox(
63
+ label="Ask your question",
64
+ placeholder="Type your question here..."
65
+ )
66
  state = gr.State([])
67
 
68
+ # Submit by pressing Enter
69
  question.submit(ask_question, [file_input, question, state], [question, chatbot])
70
 
71
  demo.launch()