arad1367 commited on
Commit
d0f6630
·
verified ·
1 Parent(s): cb6b0bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -15
app.py CHANGED
@@ -80,61 +80,75 @@ def process_pdf_and_query(pdf_file, user_query):
80
  css = """
81
  body {
82
  font-family: Arial, sans-serif;
83
- background-color: #f0f0f0;
 
84
  }
85
  .container {
86
  max-width: 800px;
87
  margin: 0 auto;
88
  padding: 20px;
89
- background-color: white;
90
  border-radius: 10px;
91
- box-shadow: 0 0 10px rgba(0,0,0,0.1);
92
  }
93
  .title {
94
  font-size: 24px;
95
  font-weight: bold;
96
  text-align: center;
97
  margin-bottom: 20px;
 
98
  }
99
  .submit-btn {
100
- background-color: #4CAF50;
101
- color: white;
102
  padding: 10px 20px;
103
  border: none;
104
  border-radius: 5px;
105
  cursor: pointer;
106
  font-size: 16px;
 
107
  }
108
  .submit-btn:hover {
109
- background-color: #45a049;
110
  }
111
  .duplicate-button {
112
- background-color: #4CAF50;
113
- color: white;
114
  padding: 10px 20px;
115
  border: none;
116
  border-radius: 5px;
117
  cursor: pointer;
118
  font-size: 16px;
 
119
  margin-top: 20px;
120
  }
 
 
 
 
 
 
 
 
 
 
121
  """
122
 
123
  explanation = """
124
- <div style="background-color: #f9f9f9; padding: 15px; border-radius: 5px; margin-bottom: 20px;">
125
- <h3>About Multimodal RAG</h3>
126
  <p>Multimodal RAG (Retrieval-Augmented Generation) combines text and image processing to provide more context-aware responses. This demo uses:</p>
127
  <ul>
128
- <li><strong>ColPali</strong>: A multimodal retriever for efficient information retrieval from images and text.</li>
129
- <li><strong>Byaldi</strong>: A new library by answer.ai that simplifies the use of ColPali.</li>
130
- <li><strong>Qwen/Qwen2-VL-2B-Instruct</strong>: A large language model capable of processing both text and visual inputs.</li>
131
  </ul>
132
  <p>This combination allows for more accurate and context-aware responses to queries about uploaded PDFs.</p>
133
  </div>
134
  """
135
 
136
  footer = """
137
- <div style="text-align: center; margin-top: 20px;">
138
  <a href="https://www.linkedin.com/in/pejman-ebrahimi-4a60151a7/" target="_blank">LinkedIn</a> |
139
  <a href="https://github.com/arad1367" target="_blank">GitHub</a> |
140
  <a href="https://arad1367.pythonanywhere.com/" target="_blank">Live demo of my PhD defense</a> |
@@ -147,7 +161,7 @@ footer = """
147
  """
148
 
149
  with gr.Blocks(css=css, theme='freddyaboulton/dracula_revamped') as demo:
150
- gr.HTML('<h1 style="text-align: center; font-size: 32px;"><a href="https://github.com/arad1367" target="_blank" style="text-decoration: none; color: inherit;">Multimodal RAG with Image Query - By Pejman Ebrahimi</a></h1>')
151
  gr.HTML(explanation)
152
  pdf_input = gr.File(label="Upload PDF")
153
  query_input = gr.Textbox(label="Enter your query", placeholder="Ask a question about the PDF")
 
80
  css = """
81
  body {
82
  font-family: Arial, sans-serif;
83
+ background-color: #2b2b2b;
84
+ color: #e0e0e0;
85
  }
86
  .container {
87
  max-width: 800px;
88
  margin: 0 auto;
89
  padding: 20px;
90
+ background-color: #363636;
91
  border-radius: 10px;
92
+ box-shadow: 0 0 10px rgba(0,0,0,0.3);
93
  }
94
  .title {
95
  font-size: 24px;
96
  font-weight: bold;
97
  text-align: center;
98
  margin-bottom: 20px;
99
+ color: #50fa7b;
100
  }
101
  .submit-btn {
102
+ background-color: #50fa7b;
103
+ color: #282a36;
104
  padding: 10px 20px;
105
  border: none;
106
  border-radius: 5px;
107
  cursor: pointer;
108
  font-size: 16px;
109
+ font-weight: bold;
110
  }
111
  .submit-btn:hover {
112
+ background-color: #45c967;
113
  }
114
  .duplicate-button {
115
+ background-color: #8be9fd;
116
+ color: #282a36;
117
  padding: 10px 20px;
118
  border: none;
119
  border-radius: 5px;
120
  cursor: pointer;
121
  font-size: 16px;
122
+ font-weight: bold;
123
  margin-top: 20px;
124
  }
125
+ .duplicate-button:hover {
126
+ background-color: #79c7d8;
127
+ }
128
+ a {
129
+ color: #8be9fd;
130
+ text-decoration: none;
131
+ }
132
+ a:hover {
133
+ text-decoration: underline;
134
+ }
135
  """
136
 
137
  explanation = """
138
+ <div style="background-color: #44475a; padding: 15px; border-radius: 5px; margin-bottom: 20px; color: #f8f8f2;">
139
+ <h3 style="color: #50fa7b;">About Multimodal RAG</h3>
140
  <p>Multimodal RAG (Retrieval-Augmented Generation) combines text and image processing to provide more context-aware responses. This demo uses:</p>
141
  <ul>
142
+ <li><strong style="color: #ffb86c;">ColPali</strong>: A multimodal retriever for efficient information retrieval from images and text.</li>
143
+ <li><strong style="color: #ffb86c;">Byaldi</strong>: A new library by answer.ai that simplifies the use of ColPali.</li>
144
+ <li><strong style="color: #ffb86c;">Qwen/Qwen2-VL-2B-Instruct</strong>: A large language model capable of processing both text and visual inputs.</li>
145
  </ul>
146
  <p>This combination allows for more accurate and context-aware responses to queries about uploaded PDFs.</p>
147
  </div>
148
  """
149
 
150
  footer = """
151
+ <div style="text-align: center; margin-top: 20px; color: #f8f8f2;">
152
  <a href="https://www.linkedin.com/in/pejman-ebrahimi-4a60151a7/" target="_blank">LinkedIn</a> |
153
  <a href="https://github.com/arad1367" target="_blank">GitHub</a> |
154
  <a href="https://arad1367.pythonanywhere.com/" target="_blank">Live demo of my PhD defense</a> |
 
161
  """
162
 
163
  with gr.Blocks(css=css, theme='freddyaboulton/dracula_revamped') as demo:
164
+ gr.HTML('<h1 style="text-align: center; font-size: 32px;"><a href="https://github.com/arad1367" target="_blank" style="text-decoration: none; color: #50fa7b;">Multimodal RAG with Image Query - By Pejman Ebrahimi</a></h1>')
165
  gr.HTML(explanation)
166
  pdf_input = gr.File(label="Upload PDF")
167
  query_input = gr.Textbox(label="Enter your query", placeholder="Ask a question about the PDF")