Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -11,13 +11,10 @@ pinned: false
|
|
| 11 |
|
| 12 |
# ZamVision
|
| 13 |
|
| 14 |
-
A
|
| 15 |
|
| 16 |
-
##
|
| 17 |
-
- image upload
|
| 18 |
-
- OCR
|
| 19 |
-
- translation
|
| 20 |
-
- visual
|
| 21 |
-
|
| 22 |
-
## Notes
|
| 23 |
-
This demo can later be connected to OCR, multilingual translation, and computer vision pipelines.
|
|
|
|
| 11 |
|
| 12 |
# ZamVision
|
| 13 |
|
| 14 |
+
A polished public demo of **ZamVision**, a smart visual assistant for OCR, translation, and image understanding.
|
| 15 |
|
| 16 |
+
## Highlights
|
| 17 |
+
- image upload workflow
|
| 18 |
+
- OCR preview
|
| 19 |
+
- translation-style experience
|
| 20 |
+
- visual AI branding
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -1,60 +1,107 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
| 3 |
def analyze_image(image, task, target_language):
|
| 4 |
if image is None:
|
| 5 |
-
return "Please upload an image
|
| 6 |
|
| 7 |
width, height = image.size
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
Demo analysis
|
| 13 |
- Image received successfully
|
| 14 |
-
-
|
| 15 |
-
-
|
| 16 |
|
| 17 |
-
|
| 18 |
- OCR text extraction
|
| 19 |
- document translation
|
| 20 |
- object recognition
|
| 21 |
-
-
|
| 22 |
"""
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
"""
|
| 31 |
-
)
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
with gr.Row():
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
btn.click(analyze_image, inputs=[image_input, task, target_language], outputs=output)
|
| 50 |
|
| 51 |
-
gr.Markdown(
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
"""
|
| 57 |
-
)
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|
| 60 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
|
| 4 |
def analyze_image(image, task, target_language):
|
| 5 |
if image is None:
|
| 6 |
+
return "Please upload an image to continue."
|
| 7 |
|
| 8 |
width, height = image.size
|
| 9 |
|
| 10 |
+
summary = f"""
|
| 11 |
+
### Vision Result
|
| 12 |
+
|
| 13 |
+
**Task:** {task}
|
| 14 |
+
**Target language:** {target_language}
|
| 15 |
+
**Image size:** {width} × {height}
|
| 16 |
|
| 17 |
+
### Demo analysis
|
| 18 |
- Image received successfully
|
| 19 |
+
- ZamVision workflow triggered
|
| 20 |
+
- Placeholder output generated for public demo
|
| 21 |
|
| 22 |
+
### Future capabilities
|
| 23 |
- OCR text extraction
|
| 24 |
- document translation
|
| 25 |
- object recognition
|
| 26 |
+
- image explanation
|
| 27 |
"""
|
| 28 |
|
| 29 |
+
return summary
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
css = """
|
| 33 |
+
.gradio-container {
|
| 34 |
+
background: linear-gradient(180deg, #08121d 0%, #10263c 100%);
|
| 35 |
+
}
|
| 36 |
+
.hero {
|
| 37 |
+
text-align: center;
|
| 38 |
+
padding: 28px 16px 10px 16px;
|
| 39 |
+
}
|
| 40 |
+
.hero h1 {
|
| 41 |
+
font-size: 2.4rem;
|
| 42 |
+
margin-bottom: 0.35rem;
|
| 43 |
+
}
|
| 44 |
+
.hero p {
|
| 45 |
+
font-size: 1.05rem;
|
| 46 |
+
opacity: 0.92;
|
| 47 |
+
}
|
| 48 |
+
.badges {
|
| 49 |
+
display: flex;
|
| 50 |
+
justify-content: center;
|
| 51 |
+
gap: 10px;
|
| 52 |
+
flex-wrap: wrap;
|
| 53 |
+
margin-top: 14px;
|
| 54 |
+
}
|
| 55 |
+
.badge {
|
| 56 |
+
background: #11324a;
|
| 57 |
+
border: 1px solid #27506a;
|
| 58 |
+
color: #e5f4ff;
|
| 59 |
+
padding: 8px 12px;
|
| 60 |
+
border-radius: 999px;
|
| 61 |
+
font-size: 0.9rem;
|
| 62 |
+
}
|
| 63 |
"""
|
|
|
|
| 64 |
|
| 65 |
+
|
| 66 |
+
with gr.Blocks(title="ZamVision", css=css, theme=gr.themes.Soft()) as demo:
|
| 67 |
+
gr.HTML("""
|
| 68 |
+
<div class="hero">
|
| 69 |
+
<h1>👁️ ZamVision</h1>
|
| 70 |
+
<p>Smart visual AI for OCR, translation, and image understanding.</p>
|
| 71 |
+
<div class="badges">
|
| 72 |
+
<div class="badge">OCR</div>
|
| 73 |
+
<div class="badge">Translation</div>
|
| 74 |
+
<div class="badge">Image Understanding</div>
|
| 75 |
+
<div class="badge">Public Demo</div>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
""")
|
| 79 |
|
| 80 |
with gr.Row():
|
| 81 |
+
with gr.Column(scale=1):
|
| 82 |
+
image_input = gr.Image(type="pil", label="Upload image")
|
| 83 |
+
task = gr.Dropdown(
|
| 84 |
+
choices=["OCR", "Document Translation", "Object Recognition", "Visual Explanation"],
|
| 85 |
+
value="OCR",
|
| 86 |
+
label="Task"
|
| 87 |
+
)
|
| 88 |
+
target_language = gr.Dropdown(
|
| 89 |
+
choices=["English", "Pashto", "Dari"],
|
| 90 |
+
value="English",
|
| 91 |
+
label="Target language"
|
| 92 |
+
)
|
| 93 |
+
btn = gr.Button("Analyze Image", variant="primary")
|
| 94 |
+
|
| 95 |
+
with gr.Column(scale=1):
|
| 96 |
+
output = gr.Markdown(label="Vision Output")
|
| 97 |
+
|
| 98 |
btn.click(analyze_image, inputs=[image_input, task, target_language], outputs=output)
|
| 99 |
|
| 100 |
+
gr.Markdown("""
|
| 101 |
+
### About this demo
|
| 102 |
+
ZamVision showcases a practical visual workflow designed for OCR, translation, and image-based assistance.
|
| 103 |
+
""")
|
| 104 |
+
|
|
|
|
|
|
|
| 105 |
|
| 106 |
if __name__ == "__main__":
|
| 107 |
demo.launch()
|