Spaces:
Sleeping
Sleeping
update
Browse files- README.md +1 -1
- app.py +6 -23
- requirements.txt +1 -1
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 🖋️
|
|
4 |
colorFrom: blue
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
4 |
colorFrom: blue
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.20.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
app.py
CHANGED
@@ -2,7 +2,6 @@ import gradio as gr
|
|
2 |
import random
|
3 |
from PIL import Image
|
4 |
|
5 |
-
# Create simple interface
|
6 |
def recognize_image(image):
|
7 |
"""Main function for the Gradio interface"""
|
8 |
if image is None:
|
@@ -30,36 +29,20 @@ def recognize_image(image):
|
|
30 |
if display_image.size[0] > 600 or display_image.size[1] > 400:
|
31 |
display_image.thumbnail((600, 400), Image.Resampling.LANCZOS)
|
32 |
|
33 |
-
formatted_result = f"
|
34 |
|
35 |
return formatted_result, display_image
|
36 |
|
37 |
except Exception as e:
|
38 |
return f"Error processing image: {str(e)}", image
|
39 |
|
|
|
40 |
demo = gr.Interface(
|
41 |
fn=recognize_image,
|
42 |
-
inputs=gr.Image(type="pil"
|
43 |
-
outputs=[
|
44 |
-
|
45 |
-
|
46 |
-
],
|
47 |
-
title="🖋️ Gregg Shorthand Recognition",
|
48 |
-
description="Upload an image of Gregg shorthand notation to convert it to readable text!",
|
49 |
-
article="""
|
50 |
-
### About This Demo
|
51 |
-
This is a demonstration of Gregg shorthand recognition using AI.
|
52 |
-
Gregg shorthand was a popular stenographic writing system used for over a century.
|
53 |
-
|
54 |
-
**Tips for best results:**
|
55 |
-
- Use clear, high-contrast images
|
56 |
-
- Ensure good lighting
|
57 |
-
- Crop to focus on the shorthand text
|
58 |
-
|
59 |
-
For more information, visit the [GitHub repository](https://github.com/a0a7/GreggRecognition).
|
60 |
-
""",
|
61 |
-
examples=None,
|
62 |
-
cache_examples=False
|
63 |
)
|
64 |
|
65 |
if __name__ == "__main__":
|
|
|
2 |
import random
|
3 |
from PIL import Image
|
4 |
|
|
|
5 |
def recognize_image(image):
|
6 |
"""Main function for the Gradio interface"""
|
7 |
if image is None:
|
|
|
29 |
if display_image.size[0] > 600 or display_image.size[1] > 400:
|
30 |
display_image.thumbnail((600, 400), Image.Resampling.LANCZOS)
|
31 |
|
32 |
+
formatted_result = f"Recognized Text: {result}\nConfidence: {confidence:.1%}"
|
33 |
|
34 |
return formatted_result, display_image
|
35 |
|
36 |
except Exception as e:
|
37 |
return f"Error processing image: {str(e)}", image
|
38 |
|
39 |
+
# Create interface with minimal configuration
|
40 |
demo = gr.Interface(
|
41 |
fn=recognize_image,
|
42 |
+
inputs=gr.Image(type="pil"),
|
43 |
+
outputs=[gr.Textbox(), gr.Image()],
|
44 |
+
title="Gregg Shorthand Recognition",
|
45 |
+
description="Upload an image of Gregg shorthand notation to convert it to readable text!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
)
|
47 |
|
48 |
if __name__ == "__main__":
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
gradio==4.
|
2 |
Pillow>=8.0.0
|
|
|
1 |
+
gradio==4.20.0
|
2 |
Pillow>=8.0.0
|