Anonymous-AC commited on
Commit
301649c
Β·
verified Β·
1 Parent(s): f1987c7

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +11 -7
  2. requirements.txt +1 -1
app.py CHANGED
@@ -1,5 +1,13 @@
1
- # import os
2
- # os.environ["HF_HOME"] = "/tmp/hf_cache"
 
 
 
 
 
 
 
 
3
  import streamlit as st
4
  from PIL import Image
5
  import torch
@@ -128,7 +136,6 @@ def apply_transform(image, size_mode=512):
128
  # Streamlit UI with Colorful Title and Emojis
129
  # st.markdown("<div style='text-align: center;'><span style='font-size: 3rem;'>🩺</span></div>", unsafe_allow_html=True)
130
  st.markdown("<h1 class='title'>Knowledge to Sight: Reasoning over Visual Attributes via Knowledge Decomposition for Abnormality Grounding</h1>", unsafe_allow_html=True)
131
-
132
  # st.markdown("<div style='text-align: center;'><span style='font-size: 3rem;'>πŸš€</span></div>", unsafe_allow_html=True)
133
  st.markdown(
134
  "<p style='text-align: center; font-size: 18px;'>Welcome to a simple demo of our work! πŸŽ‰ Choose an example or upload your own image to get started! πŸ‘‡</p>",
@@ -301,10 +308,7 @@ with col2:
301
  - The model’s responses may contain **<span style='color:#dc3545; font-weight:bold;'>πŸ€– hallucinations or incorrect information</span>**.
302
  - Always consult a **<span style='color:#dc3545; font-weight:bold;'>πŸ‘¨β€βš•οΈ medical professional</span>** for accurate diagnosis and advice.
303
  """, unsafe_allow_html=True)
304
- st.markdown("""
305
- <img src="//www.clustrmaps.com/map_v2.png?d=uM9v_RTadJ3hLvNbBSQ2PZ0KNPABbilkZgDyiXmuC0M&cl=ffffff"
306
- style="position:absolute;top:-9999px;left:-9999px;width:1px;height:1px;visibility:hidden;opacity:0;pointer-events:none;z-index:-1;display:none;" />
307
- """, unsafe_allow_html=True)
308
  # Run inference after upload
309
  if st.button("Run Inference πŸƒβ€β™‚οΈ"):
310
  if image is None:
 
1
+ import os
2
+ import shutil
3
+
4
+ # Clean and recreate HF cache directory
5
+ cache_dir = "/tmp/hf_cache"
6
+ if os.path.exists(cache_dir):
7
+ shutil.rmtree(cache_dir)
8
+ os.makedirs(cache_dir, exist_ok=True)
9
+ os.environ["HF_HOME"] = cache_dir
10
+
11
  import streamlit as st
12
  from PIL import Image
13
  import torch
 
136
  # Streamlit UI with Colorful Title and Emojis
137
  # st.markdown("<div style='text-align: center;'><span style='font-size: 3rem;'>🩺</span></div>", unsafe_allow_html=True)
138
  st.markdown("<h1 class='title'>Knowledge to Sight: Reasoning over Visual Attributes via Knowledge Decomposition for Abnormality Grounding</h1>", unsafe_allow_html=True)
 
139
  # st.markdown("<div style='text-align: center;'><span style='font-size: 3rem;'>πŸš€</span></div>", unsafe_allow_html=True)
140
  st.markdown(
141
  "<p style='text-align: center; font-size: 18px;'>Welcome to a simple demo of our work! πŸŽ‰ Choose an example or upload your own image to get started! πŸ‘‡</p>",
 
308
  - The model’s responses may contain **<span style='color:#dc3545; font-weight:bold;'>πŸ€– hallucinations or incorrect information</span>**.
309
  - Always consult a **<span style='color:#dc3545; font-weight:bold;'>πŸ‘¨β€βš•οΈ medical professional</span>** for accurate diagnosis and advice.
310
  """, unsafe_allow_html=True)
311
+
 
 
 
312
  # Run inference after upload
313
  if st.button("Run Inference πŸƒβ€β™‚οΈ"):
314
  if image is None:
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  streamlit
2
  torch
3
- transformers
4
  pillow
5
  numpy
6
  supervision
 
1
  streamlit
2
  torch
3
+ transformers==4.46.3
4
  pillow
5
  numpy
6
  supervision