Spaces:
Runtime error
Runtime error
rafaldembski
commited on
Commit
•
3479302
1
Parent(s):
f914a7f
Update app.py
Browse files
app.py
CHANGED
@@ -125,17 +125,90 @@ def inference(image):
|
|
125 |
|
126 |
return [im_rgba, pil_mask]
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
return [im_rgba, pil_mask]
|
127 |
|
128 |
+
# Translations for multi-language support
|
129 |
+
translations = {
|
130 |
+
"pl": {
|
131 |
+
"title": "Zaawansowane Segmentowanie Obrazów",
|
132 |
+
"description": """
|
133 |
+
# Zaawansowane Segmentowanie Obrazów
|
134 |
+
|
135 |
+
**Zaawansowane Segmentowanie Obrazów** to zaawansowane narzędzie oparte na sztucznej inteligencji, zaprojektowane do precyzyjnego segmentowania obrazów. Aplikacja ta wykorzystuje najnowsze technologie głębokiego uczenia, aby generować dokładne maski dla różnych typów obrazów. Stworzona przez ekspertów, oferuje użytkownikom intuicyjny interfejs do przetwarzania obrazów. Niezależnie od tego, czy jest używana do celów zawodowych, czy do projektów osobistych, to narzędzie zapewnia najwyższą jakość i niezawodność w zadaniach segmentacji obrazów.
|
136 |
+
""",
|
137 |
+
"article": """
|
138 |
+
## Technologie
|
139 |
+
|
140 |
+
- **Model**: ISNetDIS
|
141 |
+
- **Stworzony przez**: Rafał Dembski
|
142 |
+
- **Technologie**: PyTorch, Gradio, OpenCV
|
143 |
+
"""
|
144 |
+
},
|
145 |
+
"en": {
|
146 |
+
"title": "Advanced Image Segmentation",
|
147 |
+
"description": """
|
148 |
+
# Advanced Image Segmentation
|
149 |
+
|
150 |
+
**Advanced Image Segmentation** is a cutting-edge AI-powered tool developed to provide highly accurate image segmentation. This application utilizes state-of-the-art deep learning techniques to generate precise masks for various types of images. Developed by experts, it offers users an intuitive interface to process their images effortlessly. Whether for professional use or personal projects, this tool ensures superior quality and reliability in image segmentation tasks.
|
151 |
+
""",
|
152 |
+
"article": """
|
153 |
+
## Technologies
|
154 |
+
|
155 |
+
- **Model**: ISNetDIS
|
156 |
+
- **Developed by**: Rafał Dembski
|
157 |
+
- **Technologies**: PyTorch, Gradio, OpenCV
|
158 |
+
"""
|
159 |
+
},
|
160 |
+
"de": {
|
161 |
+
"title": "Fortschrittliche Bildsegmentierung",
|
162 |
+
"description": """
|
163 |
+
# Fortschrittliche Bildsegmentierung
|
164 |
+
|
165 |
+
**Fortschrittliche Bildsegmentierung** ist ein fortschrittliches KI-gestütztes Tool, das entwickelt wurde, um hochpräzise Bildsegmentierung zu ermöglichen. Diese Anwendung nutzt modernste Techniken des Deep Learnings, um präzise Masken für verschiedene Arten von Bildern zu erstellen. Entwickelt von Experten, bietet es den Benutzern eine intuitive Oberfläche zur mühelosen Verarbeitung ihrer Bilder. Ob für professionelle Zwecke oder persönliche Projekte, dieses Tool gewährleistet höchste Qualität und Zuverlässigkeit bei Segmentierungsaufgaben.
|
166 |
+
""",
|
167 |
+
"article": """
|
168 |
+
## Technologien
|
169 |
+
|
170 |
+
- **Modell**: ISNetDIS
|
171 |
+
- **Entwickelt von**: Rafał Dembski
|
172 |
+
- **Technologien**: PyTorch, Gradio, OpenCV
|
173 |
+
"""
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
# Gradio setup with Monochrome theme, logo, and description with language support
|
178 |
+
css = """
|
179 |
+
#col-container {
|
180 |
+
margin: 0 auto;
|
181 |
+
max-width: 520px;
|
182 |
+
}
|
183 |
+
"""
|
184 |
+
|
185 |
+
def change_language(lang):
|
186 |
+
return translations[lang]['title'], translations[lang]['description'], translations[lang]['article']
|
187 |
+
|
188 |
+
with gr.Blocks(theme=gr.themes.Monochrome(), css=css) as demo:
|
189 |
+
language_selector = gr.Dropdown(choices=["pl", "en", "de"], value="en", label="Wybierz język / Select Language / Sprache auswählen", show_label=True)
|
190 |
+
|
191 |
+
title = gr.Markdown(translations["en"]["title"])
|
192 |
+
description = gr.Markdown(translations["en"]["description"])
|
193 |
+
article = gr.Markdown(translations["en"]["article"])
|
194 |
+
|
195 |
+
with gr.Row():
|
196 |
+
prompt = gr.Image(type='filepath')
|
197 |
+
result = gr.Image(label="Segmented Image", show_label=False)
|
198 |
+
|
199 |
+
language_selector.change(
|
200 |
+
fn=change_language,
|
201 |
+
inputs=language_selector,
|
202 |
+
outputs=[title, description, article],
|
203 |
+
)
|
204 |
+
|
205 |
+
gr.Interface(
|
206 |
+
fn=inference,
|
207 |
+
inputs=prompt,
|
208 |
+
outputs=[result],
|
209 |
+
title=title,
|
210 |
+
description=description,
|
211 |
+
article=article,
|
212 |
+
allow_flagging='never',
|
213 |
+
cache_examples=False,
|
214 |
+
).launch()
|