Spaces:
Runtime error
Runtime error
Denver Citizen9
commited on
Commit
·
b04c40f
1
Parent(s):
a7ddfba
updated - how big of an example?
Browse files
app.py
CHANGED
@@ -6,14 +6,8 @@ def process_json(json_data):
|
|
6 |
return f"Processed JSON data: {json_data}"
|
7 |
|
8 |
def launch_demo():
|
9 |
-
input_text = gr.inputs.Textbox(label="Enter JSON data")
|
10 |
|
11 |
-
|
12 |
-
result = process_json(json_data)
|
13 |
-
return result
|
14 |
-
|
15 |
-
examples = [
|
16 |
-
["""{
|
17 |
\"base64\" : \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAg...\" ,
|
18 |
\"result\" : [
|
19 |
{
|
@@ -2728,16 +2722,22 @@ def launch_demo():
|
|
2728 |
]
|
2729 |
}
|
2730 |
]
|
2731 |
-
}"""
|
2732 |
-
|
|
|
|
|
|
|
|
|
|
|
2733 |
|
2734 |
gr.Interface(
|
2735 |
fn=submit_json,
|
2736 |
-
inputs=
|
2737 |
outputs="text",
|
2738 |
examples=examples,
|
2739 |
-
title="
|
2740 |
-
description="Enter JSON data and click Submit to process it.
|
|
|
2741 |
theme="default",
|
2742 |
).launch()
|
2743 |
|
|
|
6 |
return f"Processed JSON data: {json_data}"
|
7 |
|
8 |
def launch_demo():
|
|
|
9 |
|
10 |
+
default_example = """{
|
|
|
|
|
|
|
|
|
|
|
11 |
\"base64\" : \"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAg...\" ,
|
12 |
\"result\" : [
|
13 |
{
|
|
|
2722 |
]
|
2723 |
}
|
2724 |
]
|
2725 |
+
}"""
|
2726 |
+
|
2727 |
+
input_json = gr.inputs.Textbox(label="Enter OCR JSON (or click example)", default=default_example)
|
2728 |
+
|
2729 |
+
def submit_json(json_data):
|
2730 |
+
result = process_json(json_data)
|
2731 |
+
return result
|
2732 |
|
2733 |
gr.Interface(
|
2734 |
fn=submit_json,
|
2735 |
+
inputs=[input_json],
|
2736 |
outputs="text",
|
2737 |
examples=examples,
|
2738 |
+
title="Snail Mail Muncher",
|
2739 |
+
description="""Enter JSON data from PP OCR v3 and click Submit to process it.
|
2740 |
+
Note that an enhanced workflow would start with an image file, send it to a hosted PP-OCR inference API, process it to get this JSON, and submit for you. This is a simple example that let's you copy/paste json from your own document OR you may also use the example, which comes from the 'SampleCableBill.png' in the related repo. In this example we use OpenAI but with an updated prompt something open source like Dolly would be more ideal.""",
|
2741 |
theme="default",
|
2742 |
).launch()
|
2743 |
|