HimanshuGoyal2004 commited on
Commit
04f3534
Β·
1 Parent(s): a8c0a8e

ui betterment

Browse files
Files changed (1) hide show
  1. app.py +23 -14
app.py CHANGED
@@ -98,40 +98,49 @@ def clear_state():
98
 
99
  # UI Setup
100
  with gr.Blocks(
101
- theme=gr.themes.Default(
102
- primary_hue="green",
103
  secondary_hue="blue",
104
- font=[gr.themes.GoogleFont("Poppins")],
105
  ),
106
  css="footer {visibility: hidden}",
107
  ) as demo:
108
- gr.Markdown("# Doc Q&A πŸ€–πŸ“ƒ")
 
109
  with gr.Row():
110
- with gr.Column(scale=1):
 
111
  file_input = gr.File(
112
  file_count="single", type="filepath", label="Upload Document"
113
  )
 
114
  with gr.Row():
115
- btn = gr.Button("Submit", variant="primary")
116
- clear = gr.Button("Clear")
117
- output = gr.Textbox(label="Status")
118
  with gr.Column(scale=3):
119
  chatbot = gr.ChatInterface(
120
  fn=respond,
121
- chatbot=gr.Chatbot(height=300),
122
- theme="soft",
123
- show_progress="full",
 
124
  textbox=gr.Textbox(
125
- placeholder="Ask questions about the uploaded document!",
126
  container=False,
 
127
  ),
 
 
128
  )
129
 
130
  # Set up Gradio interactions
131
  btn.click(fn=load_files, inputs=file_input, outputs=output)
 
132
  clear.click(
133
- fn=clear_state, # Use the clear_state function
134
- outputs=[file_input, output],
 
135
  )
136
 
137
  # Launch the demo - ONLY CHANGE THIS LINE
 
98
 
99
  # UI Setup
100
  with gr.Blocks(
101
+ theme=gr.themes.Monochrome(
102
+ primary_hue="indigo",
103
  secondary_hue="blue",
104
+ font=[gr.themes.GoogleFont("Inter"), "system-ui", "sans-serif"],
105
  ),
106
  css="footer {visibility: hidden}",
107
  ) as demo:
108
+ gr.Markdown("# Document Q&A πŸ€–πŸ“ƒ")
109
+
110
  with gr.Row():
111
+ with gr.Column(scale=1, min_width=300):
112
+ gr.Markdown("### Controls")
113
  file_input = gr.File(
114
  file_count="single", type="filepath", label="Upload Document"
115
  )
116
+ output = gr.Textbox(label="Status", interactive=False)
117
  with gr.Row():
118
+ btn = gr.Button("1. Process Document", variant="primary", scale=2)
119
+ clear = gr.Button("Clear All", scale=1)
120
+
121
  with gr.Column(scale=3):
122
  chatbot = gr.ChatInterface(
123
  fn=respond,
124
+ chatbot=gr.Chatbot(
125
+ height=500,
126
+ label="Chat Window",
127
+ ),
128
  textbox=gr.Textbox(
129
+ placeholder="2. Ask questions about the document here...",
130
  container=False,
131
+ scale=7,
132
  ),
133
+ submit_btn="Ask",
134
+ show_progress="full",
135
  )
136
 
137
  # Set up Gradio interactions
138
  btn.click(fn=load_files, inputs=file_input, outputs=output)
139
+
140
  clear.click(
141
+ fn=clear_state, # Use the clear_state function
142
+ outputs=[file_input, output, chatbot],
143
+ queue=False
144
  )
145
 
146
  # Launch the demo - ONLY CHANGE THIS LINE