mishmish1 commited on
Commit
35a5048
·
1 Parent(s): 3f6c226

Add funding acknowledgment section with logos and text in app.py and README.md

Browse files
Files changed (4) hide show
  1. README.md +8 -0
  2. app.py +59 -0
  3. img/EU.png +0 -0
  4. img/TACR.png +0 -0
README.md CHANGED
@@ -11,3 +11,11 @@ license: mit
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
14
+
15
+ ## Funding
16
+
17
+ <img src="img/EU.png" alt="Funded by the European Union — NextGenerationEU" height="56"> &nbsp;&nbsp; <img src="img/TACR.png" alt="Technology Agency of the Czech Republic" height="56">
18
+
19
+ Project TN02000122 REcombinant TEchnologies for MEDicine (RETEMED) is co-financed from the state budget by the Technology Agency of the Czech Republic under the National Centres of Competence Progamme.
20
+
21
+ Sub-project TN02000122/001N Therapeutics of Recombinant and Natural Origin (TEREP) is co-financed through the Technology Agency of the Czech Republic under the National Recovery Plan from the EU Recovery and Resilience Facility.
app.py CHANGED
@@ -209,6 +209,63 @@ def create_3dmol_html(pdb_content: str, title: str = "") -> str:
209
 
210
 
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  # Main Prediction Logic
213
 
214
  def _progress_html(fraction: float, desc: str) -> str:
@@ -594,6 +651,8 @@ with gr.Blocks(
594
  label="Run Log"
595
  )
596
 
 
 
597
  predict_btn.click(
598
  fn=predict_structure,
599
  inputs=[sequence_input, ttt_steps, learning_rate, batch_size, lora_rank, lora_alpha, seed],
 
209
 
210
 
211
 
212
+ def _img_data_uri(path: str) -> str | None:
213
+ """Base64-encode a local image as a data URI, or None if unavailable.
214
+
215
+ Embedding avoids relying on Gradio/Spaces static file serving.
216
+ """
217
+ import base64
218
+ import mimetypes
219
+
220
+ try:
221
+ with open(path, "rb") as f:
222
+ payload = base64.b64encode(f.read()).decode("ascii")
223
+ except OSError:
224
+ print(f"[WARN] Funding logo not found: {path}")
225
+ return None
226
+
227
+ mime = mimetypes.guess_type(path)[0] or "image/png"
228
+ return f"data:{mime};base64,{payload}"
229
+
230
+
231
+ FUNDING_TEXT = (
232
+ "Project TN02000122 REcombinant TEchnologies for MEDicine (RETEMED) is "
233
+ "co-financed from the state budget by the Technology Agency of the Czech "
234
+ "Republic under the National Centres of Competence Progamme.<br>"
235
+ "Sub-project TN02000122/001N Therapeutics of Recombinant and Natural "
236
+ "Origin (TEREP) is co-financed through the Technology Agency of the Czech "
237
+ "Republic under the National Recovery Plan from the EU Recovery and "
238
+ "Resilience Facility."
239
+ )
240
+
241
+
242
+ def create_funding_html() -> str:
243
+ """Return the funding acknowledgement footer (logos + required text)."""
244
+ _here = os.path.dirname(os.path.abspath(__file__))
245
+ logos = [
246
+ (_img_data_uri(os.path.join(_here, "img", "EU.png")),
247
+ "Funded by the European Union — NextGenerationEU"),
248
+ (_img_data_uri(os.path.join(_here, "img", "TACR.png")),
249
+ "Technology Agency of the Czech Republic"),
250
+ ]
251
+ logo_tags = "".join(
252
+ f'<img src="{src}" alt="{alt}" style="height: 56px; width: auto;">'
253
+ for src, alt in logos if src is not None
254
+ )
255
+
256
+ return f"""
257
+ <div style="margin-top: 24px; padding-top: 16px;
258
+ border-top: 1px solid rgba(128, 128, 128, 0.3);">
259
+ <div style="display: flex; align-items: center; gap: 24px;
260
+ flex-wrap: wrap; margin-bottom: 12px;">
261
+ {logo_tags}
262
+ </div>
263
+ <div style="font-size: 12px; line-height: 1.5; opacity: 0.8;">
264
+ {FUNDING_TEXT}
265
+ </div>
266
+ </div>"""
267
+
268
+
269
  # Main Prediction Logic
270
 
271
  def _progress_html(fraction: float, desc: str) -> str:
 
651
  label="Run Log"
652
  )
653
 
654
+ gr.HTML(create_funding_html())
655
+
656
  predict_btn.click(
657
  fn=predict_structure,
658
  inputs=[sequence_input, ttt_steps, learning_rate, batch_size, lora_rank, lora_alpha, seed],
img/EU.png ADDED
img/TACR.png ADDED