zamal commited on
Commit
f2e2870
·
verified ·
1 Parent(s): 20ac3f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -35
app.py CHANGED
@@ -126,52 +126,68 @@ def lite_runner(topic):
126
  # ---------------------------
127
  # App UI Setup Using Gradio Soft Theme with Centered Layout
128
  # ---------------------------
129
- with gr.Blocks(css=CSS, theme=gr.themes.Soft(text_size=sizes.text_md)) as demo:
130
- # Header with logo and title aligned side-by-side
 
 
 
 
 
 
 
 
131
  gr.Markdown(
132
  """
133
- <div style="display: flex; align-items: center; justify-content: center; padding-top: 60px;">
134
- <img src="https://img.icons8.com/?size=100&id=118557&format=png&color=000000"
135
- style="width: 60px; height: 60px; margin-right: 12px;">
136
- <h1 style="margin: 0; font-size: 2.2em;">DeepGit Lite</h1>
137
- </div>
138
- <div style="text-align: center; margin-top: 10px;">
139
- <p style="margin: 0;">
140
- DeepGit-lite is a nano version of DeepGit 🌱<br>
141
- Explore GitHub repositories with deep semantic search.<br>
142
- Check out our <a href="https://github.com/zamalali/DeepGit" target="_blank">GitHub</a> to explore the full DeepGit version.<br>
143
- Give a ⭐ on GitHub.
144
- </p>
145
  </div>
146
  """,
147
  elem_id="header"
148
  )
149
-
150
- # (Optional) Additional state variables, tabs, and UI elements as needed.
151
- vectordb = gr.State()
152
- doc_collection = gr.State(value=[])
153
- session_states = gr.State(value={})
154
- references = gr.State(value=[])
155
 
156
- gr.Markdown(
157
- """<h2><center>Chat PDF Multimodal 💬 </center></h2>
158
- <h3><center><b>Interact With Your PDF Documents</b></center></h3>"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  )
160
- gr.Markdown(
161
- """<center>
162
- <h3><b>Note: </b> This application leverages advanced Retrieval-Augmented Generation (RAG) techniques to provide context-aware responses from your PDF documents</center>
163
- <h3><br>
164
- <center>Utilizing multimodal capabilities, this chatbot can understand and answer queries based on both textual and visual information within your PDFs.</center>
165
- """
 
166
  )
167
- gr.Markdown(
 
168
  """
169
- <center><b>Warning: </b> Extracting text and images from your document and generating embeddings may take some time due to the use of OCR and multimodal LLMs for image description<center>
 
 
170
  """
171
  )
172
-
173
- # ... (The rest of your Tabs and UI components go here.)
174
-
175
- gr.HTML('<div style="text-align: center; margin-top: 20px;">Made with ❤️ by <b>Zamal</b></div>')
176
 
177
  demo.queue(max_size=10).launch()
 
126
  # ---------------------------
127
  # App UI Setup Using Gradio Soft Theme with Centered Layout
128
  # ---------------------------
129
+ with gr.Blocks(
130
+ theme=gr.themes.Soft(text_size=sizes.text_md)),
131
+ title="DeepGit Lite",
132
+ css="""
133
+ /* Center header and footer */
134
+ #header { text-align: center; margin-bottom: 20px; }
135
+ #main-container { max-width: 800px; margin: auto; }
136
+ #footer { text-align: center; margin-top: 20px; }
137
+ """
138
+ ) as demo:
139
  gr.Markdown(
140
  """
141
+ <div style="padding-top: 60px;">
142
+ <div style="display: flex; align-items: center; justify-content: center;">
143
+ <img src="https://img.icons8.com/?size=100&id=118557&format=png&color=000000" style="width: 60px; height: 60px; margin-right: 12px;">
144
+ <h1 style="margin: 0; font-size: 2.2em;">DeepGit Lite</h1>
145
+ </div>
146
+ <div style="text-align: center; margin-top: 10px;">
147
+ <p style="margin: 0;">
148
+ Explore GitHub repositories with deep semantic search.<br>
149
+ Check out our <a href="https://github.com/zamalali/DeepGit" target="_blank">GitHub</a> for more details.
150
+ </p>
151
+ </div>
 
152
  </div>
153
  """,
154
  elem_id="header"
155
  )
 
 
 
 
 
 
156
 
157
+
158
+ # Centered main container for inputs and outputs.
159
+ with gr.Column(elem_id="main-container"):
160
+ research_input = gr.Textbox(
161
+ label="Research Query",
162
+ placeholder="Enter your research topic here, e.g., 'data augmentation pipelines for LLM fine-tuning'",
163
+ lines=3
164
+ )
165
+ run_button = gr.Button("Run DeepGit Lite", variant="primary")
166
+ status_display = gr.Markdown(label="Status")
167
+ detail_display = gr.HTML(label="Results")
168
+
169
+ run_button.click(
170
+ fn=lite_runner,
171
+ inputs=[research_input],
172
+ outputs=[status_display, detail_display],
173
+ api_name="deepgit_lite",
174
+ show_progress=True
175
  )
176
+
177
+ research_input.submit(
178
+ fn=lite_runner,
179
+ inputs=[research_input],
180
+ outputs=[status_display, detail_display],
181
+ api_name="deepgit_lite_submit",
182
+ show_progress=True
183
  )
184
+
185
+ gr.HTML(
186
  """
187
+ <div id="footer">
188
+ Made with ❤️ by <b>Zamal</b>
189
+ </div>
190
  """
191
  )
 
 
 
 
192
 
193
  demo.queue(max_size=10).launch()