Spaces:
Runtime error
Runtime error
Commit
·
f4f4778
1
Parent(s):
fdbe404
added streamlit app for inference
Browse files- .gitignore +1 -0
- README.md +10 -0
- app.py +40 -0
.gitignore
CHANGED
|
@@ -130,4 +130,5 @@ dmypy.json
|
|
| 130 |
|
| 131 |
# Datasets
|
| 132 |
datasets/
|
|
|
|
| 133 |
**.h5
|
|
|
|
| 130 |
|
| 131 |
# Datasets
|
| 132 |
datasets/
|
| 133 |
+
**.zip
|
| 134 |
**.h5
|
README.md
CHANGED
|
@@ -1 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# enhance-me
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Enhance Me
|
| 3 |
+
emoji: 🌖
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
# enhance-me
|
app.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PIL import Image
|
| 2 |
+
import streamlit as st
|
| 3 |
+
from tensorflow.keras import utils
|
| 4 |
+
|
| 5 |
+
from enhance_me.mirnet import MIRNet
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
@st.cache
|
| 9 |
+
def get_mirnet_object() -> MIRNet:
|
| 10 |
+
mirnet = MIRNet()
|
| 11 |
+
mirnet.build_model()
|
| 12 |
+
utils.get_file(
|
| 13 |
+
"weights_lol_128.h5",
|
| 14 |
+
"https://github.com/soumik12345/enhance-me/releases/download/v0.2/weights_lol_128.h5",
|
| 15 |
+
cache_dir=".",
|
| 16 |
+
cache_subdir="weights",
|
| 17 |
+
)
|
| 18 |
+
mirnet.load_weights("./weights/weights_lol_128.h5")
|
| 19 |
+
return mirnet
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def main():
|
| 23 |
+
st.markdown("# Enhance Me")
|
| 24 |
+
st.markdown("Made with :heart: by [geekyRakshit](http://github.com/soumik12345)")
|
| 25 |
+
application = st.sidebar.selectbox(
|
| 26 |
+
"Please select the application:", ("", "Low-light enhancement")
|
| 27 |
+
)
|
| 28 |
+
if application != "":
|
| 29 |
+
if application == "Low-light enhancement":
|
| 30 |
+
uploaded_file = st.sidebar.file_uploader("Select your image:")
|
| 31 |
+
if uploaded_file is not None:
|
| 32 |
+
original_image = Image.open(uploaded_file)
|
| 33 |
+
st.image(original_image, caption="original image")
|
| 34 |
+
mirnet = get_mirnet_object()
|
| 35 |
+
enhanced_image = mirnet.infer(original_image)
|
| 36 |
+
st.image(enhanced_image, caption="enhanced image")
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
if __name__ == "__main__":
|
| 40 |
+
main()
|