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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -52
app.py CHANGED
@@ -3,6 +3,7 @@ import spaces
3
 
4
  import gradio as gr
5
  import time
 
6
  import threading
7
  import logging
8
  from main import run_repository_ranking # Your repository ranking function
@@ -125,69 +126,52 @@ def lite_runner(topic):
125
  # ---------------------------
126
  # App UI Setup Using Gradio Soft Theme with Centered Layout
127
  # ---------------------------
128
- with gr.Blocks(
129
- theme="gstaff/sketch",
130
- title="DeepGit Lite",
131
- css="""
132
- /* Center header and footer */
133
- #header { text-align: center; margin-bottom: 20px; }
134
- #main-container { max-width: 800px; margin: auto; }
135
- #footer { text-align: center; margin-top: 20px; }
136
- """
137
- ) as demo:
138
  gr.Markdown(
139
  """
140
- <div style="padding-top: 60px;">
141
- <div style="display: flex; align-items: center; justify-content: center;">
142
- <img src="https://img.icons8.com/?size=100&id=118557&format=png&color=000000" style="width: 60px; height: 60px; margin-right: 12px;">
143
- <h1 style="margin: 0; font-size: 2.2em;">DeepGit Lite</h1>
144
- </div>
145
- <div style="text-align: center; margin-top: 10px;">
146
- <p style="margin: 0;">
147
- DeepGit-lite is a nano version of DeepGit 🌱<br>
148
- Explore GitHub repositories with deep semantic search.<br>
149
- Check out our <a href="https://github.com/zamalali/DeepGit" target="_blank">GitHub</a> to explore the full DeepGit version. <br> Give a ⭐ on GitHub. <br>
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, simply describe as detailed as possible for wider context 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()
 
3
 
4
  import gradio as gr
5
  import time
6
+ from gradio.themes.utils import sizes
7
  import threading
8
  import logging
9
  from main import run_repository_ranking # Your repository ranking function
 
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()