Spaces:
Sleeping
Sleeping
Use older stable gradio 4.19.2 with matching gradio_client
Browse files- app.py +4 -7
- requirements.txt +3 -2
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
-
Gradio UI application for Batik Classification
|
| 3 |
Optimized for Hugging Face Spaces deployment
|
| 4 |
"""
|
| 5 |
import gradio as gr
|
|
@@ -21,7 +21,6 @@ transform = None
|
|
| 21 |
|
| 22 |
|
| 23 |
def load_model():
|
| 24 |
-
"""Load VGG16 model and configuration"""
|
| 25 |
global model, class_names, transform
|
| 26 |
|
| 27 |
try:
|
|
@@ -95,11 +94,11 @@ def predict_image(image):
|
|
| 95 |
Tuple of (top_k_dict, formatted_text)
|
| 96 |
"""
|
| 97 |
global model, transform, class_names
|
| 98 |
-
|
| 99 |
try:
|
| 100 |
if image is None:
|
| 101 |
return None, "โ Silakan upload gambar batik terlebih dahulu"
|
| 102 |
-
|
| 103 |
if model is None:
|
| 104 |
return None, "โ Model belum dimuat. Silakan refresh halaman."
|
| 105 |
|
|
@@ -157,14 +156,13 @@ print("โ
Model ready!")
|
|
| 157 |
|
| 158 |
# Create Gradio interface
|
| 159 |
with gr.Blocks(
|
| 160 |
-
title="Batik Classification
|
| 161 |
theme=gr.themes.Soft(),
|
| 162 |
css=".gradio-container {max-width: 1200px; margin: auto;}"
|
| 163 |
) as demo:
|
| 164 |
|
| 165 |
gr.Markdown("""
|
| 166 |
# ๐จ Klasifikasi Motif Batik Indonesia
|
| 167 |
-
### Menggunakan Model VGG16 Deep Learning
|
| 168 |
|
| 169 |
Upload gambar batik untuk mengetahui motif dan asalnya!
|
| 170 |
**Total 111 motif batik** dari berbagai daerah di Indonesia ๐ฎ๐ฉ
|
|
@@ -207,7 +205,6 @@ with gr.Blocks(
|
|
| 207 |
gr.Markdown("""
|
| 208 |
---
|
| 209 |
### ๐ Tentang Model
|
| 210 |
-
- **Arsitektur:** VGG16 (Modified)
|
| 211 |
- **Dataset:** 111 Motif Batik Indonesia
|
| 212 |
- **Kategori:** Batik dari Jawa Tengah, Jawa Timur, Jawa Barat, Bali, Jakarta, Kalimantan, Lampung
|
| 213 |
|
|
|
|
| 1 |
"""
|
| 2 |
+
Gradio UI application for Batik Classification
|
| 3 |
Optimized for Hugging Face Spaces deployment
|
| 4 |
"""
|
| 5 |
import gradio as gr
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
def load_model():
|
|
|
|
| 24 |
global model, class_names, transform
|
| 25 |
|
| 26 |
try:
|
|
|
|
| 94 |
Tuple of (top_k_dict, formatted_text)
|
| 95 |
"""
|
| 96 |
global model, transform, class_names
|
| 97 |
+
|
| 98 |
try:
|
| 99 |
if image is None:
|
| 100 |
return None, "โ Silakan upload gambar batik terlebih dahulu"
|
| 101 |
+
|
| 102 |
if model is None:
|
| 103 |
return None, "โ Model belum dimuat. Silakan refresh halaman."
|
| 104 |
|
|
|
|
| 156 |
|
| 157 |
# Create Gradio interface
|
| 158 |
with gr.Blocks(
|
| 159 |
+
title="Batik Classification",
|
| 160 |
theme=gr.themes.Soft(),
|
| 161 |
css=".gradio-container {max-width: 1200px; margin: auto;}"
|
| 162 |
) as demo:
|
| 163 |
|
| 164 |
gr.Markdown("""
|
| 165 |
# ๐จ Klasifikasi Motif Batik Indonesia
|
|
|
|
| 166 |
|
| 167 |
Upload gambar batik untuk mengetahui motif dan asalnya!
|
| 168 |
**Total 111 motif batik** dari berbagai daerah di Indonesia ๐ฎ๐ฉ
|
|
|
|
| 205 |
gr.Markdown("""
|
| 206 |
---
|
| 207 |
### ๐ Tentang Model
|
|
|
|
| 208 |
- **Dataset:** 111 Motif Batik Indonesia
|
| 209 |
- **Kategori:** Batik dari Jawa Tengah, Jawa Timur, Jawa Barat, Bali, Jakarta, Kalimantan, Lampung
|
| 210 |
|
requirements.txt
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
# Requirements untuk Gradio App
|
| 2 |
-
gradio==4.
|
|
|
|
| 3 |
torch==2.1.0
|
| 4 |
torchvision==0.16.0
|
| 5 |
Pillow>=10.0.0
|
| 6 |
numpy>=1.24.0
|
| 7 |
-
huggingface_hub==0.
|
| 8 |
requests
|
|
|
|
| 1 |
# Requirements untuk Gradio App
|
| 2 |
+
gradio==4.19.2
|
| 3 |
+
gradio_client==0.10.1
|
| 4 |
torch==2.1.0
|
| 5 |
torchvision==0.16.0
|
| 6 |
Pillow>=10.0.0
|
| 7 |
numpy>=1.24.0
|
| 8 |
+
huggingface_hub==0.21.4
|
| 9 |
requests
|