Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,7 @@ The tool consists of the following components:
|
|
| 17 |
To run the tool:
|
| 18 |
1. Save the script as `cell_exp_past.py`.
|
| 19 |
2. Run the script in a Python environment.
|
|
|
|
| 20 |
```python
|
| 21 |
streamlit run cell_exp_past.py
|
| 22 |
```
|
|
@@ -39,6 +40,23 @@ import zipfile
|
|
| 39 |
import json
|
| 40 |
|
| 41 |
def zoom_at(img, x, y, zoom):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
w, h = img.size
|
| 43 |
zoom2 = zoom * 2
|
| 44 |
img = img.crop((x - w / zoom2, y - h / zoom2,
|
|
@@ -47,6 +65,13 @@ def zoom_at(img, x, y, zoom):
|
|
| 47 |
|
| 48 |
st.title("CLL Image Processing Tool")
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
uploaded_files = st.file_uploader("Upload Images", accept_multiple_files=True, type="jpg")
|
| 51 |
|
| 52 |
if uploaded_files:
|
|
|
|
| 17 |
To run the tool:
|
| 18 |
1. Save the script as `cell_exp_past.py`.
|
| 19 |
2. Run the script in a Python environment.
|
| 20 |
+
|
| 21 |
```python
|
| 22 |
streamlit run cell_exp_past.py
|
| 23 |
```
|
|
|
|
| 40 |
import json
|
| 41 |
|
| 42 |
def zoom_at(img, x, y, zoom):
|
| 43 |
+
'''
|
| 44 |
+
increase the zoom level of the image at a specific point (x, y).
|
| 45 |
+
|
| 46 |
+
Parameters:
|
| 47 |
+
img (PIL.Image): The input image.
|
| 48 |
+
x (int): The x-coordinate of the point.
|
| 49 |
+
y (int): The y-coordinate of the point.
|
| 50 |
+
zoom (float): The zoom level.
|
| 51 |
+
|
| 52 |
+
Returns:
|
| 53 |
+
PIL.Image: The zoomed image.
|
| 54 |
+
|
| 55 |
+
Examples:
|
| 56 |
+
>>> img = Image.open('image.jpg')
|
| 57 |
+
>>> zoomed_img = zoom_at(img, 100, 100, 2.0)
|
| 58 |
+
|
| 59 |
+
'''
|
| 60 |
w, h = img.size
|
| 61 |
zoom2 = zoom * 2
|
| 62 |
img = img.crop((x - w / zoom2, y - h / zoom2,
|
|
|
|
| 65 |
|
| 66 |
st.title("CLL Image Processing Tool")
|
| 67 |
|
| 68 |
+
st.write('''This tool allows you to upload microscope images,
|
| 69 |
+
adjust the view with zoom and enhancement controls,
|
| 70 |
+
and save the processed image along with annotations.
|
| 71 |
+
You can also export the processed image, description,
|
| 72 |
+
and parameters as a zip file.
|
| 73 |
+
''')
|
| 74 |
+
|
| 75 |
uploaded_files = st.file_uploader("Upload Images", accept_multiple_files=True, type="jpg")
|
| 76 |
|
| 77 |
if uploaded_files:
|