Spaces:
Build error
Build error
import gradio as gr | |
from deploy import ocr_btn | |
import pandas as pd | |
with gr.Blocks() as demo: | |
image_input = gr.inputs.Image(label="Upload Image") | |
webcam_input = gr.inputs.Image(label="Webcam", source="webcam") | |
card_type_input = gr.inputs.Dropdown(["passport", "id_card"], label="Card Type", default="id_card") | |
# column_names = ["name", "dob", "gender", "country", "doc_num"] | |
# input_table = gr.inputs.Table(columns=column_names) | |
data = { | |
"Name": ["John", "Emma", "Michael"], | |
"Age": [25, 30, 35], | |
"Country": ["USA", "Canada", "UK"] | |
} | |
df = pd.DataFrame(data) | |
table_input = gr.inputs.Table(headers=list(df.columns), row_count=len(df), default_data=df.values.tolist()) | |
# Define the output components | |
json_output = gr.outputs.JSON(label="JSON Output") | |
string_output = gr.outputs.Textbox(label="OCR Extracted Text") | |
# Create the Gradio interface | |
interface = gr.Interface(fn=ocr_btn, inputs=[card_type_input,image_input,webcam_input], outputs=[json_output, string_output]) | |
interface.launch(share=True) | |
if __name__ == "__main__": | |
demo.launch() | |