wjbmattingly commited on
Commit
b4fde32
1 Parent(s): 0a6f4b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -89,16 +89,21 @@ examples = [
89
  ]
90
 
91
  # Gradio interface
92
- iface = gr.Interface(
93
- fn=process_image,
94
- inputs=[
95
- gr.Image(type="pil", label="Input Image"),
96
- gr.Dropdown(choices=list(MODEL_OPTIONS.keys()), label="Select Model", value="Medieval Base")
97
- ],
98
- outputs=gr.Textbox(label="Transcription"),
99
- title="Medieval TrOCR Model Switcher",
100
- description="Upload an image of medieval text and select a model to transcribe it. Note: This tool is designed to work on a single line of text at a time for optimal results.",
101
- examples=examples
102
- )
 
 
 
 
 
103
 
104
  iface.launch()
 
89
  ]
90
 
91
  # Gradio interface
92
+ with gr.Blocks() as iface:
93
+ gr.Markdown("# Medieval TrOCR Model Switcher")
94
+ gr.Markdown("Upload an image of medieval text and select a model to transcribe it. Note: This tool is designed to work on a single line of text at a time for optimal results.")
95
+
96
+ with gr.Row():
97
+ with gr.Column(scale=2):
98
+ input_image = gr.Image(type="pil", label="Input Image")
99
+ with gr.Column(scale=1):
100
+ model_dropdown = gr.Dropdown(choices=list(MODEL_OPTIONS.keys()), label="Select Model", value="Medieval Base")
101
+
102
+ transcription_output = gr.Textbox(label="Transcription")
103
+
104
+ submit_button = gr.Button("Transcribe")
105
+ submit_button.click(fn=process_image, inputs=[input_image, model_dropdown], outputs=transcription_output)
106
+
107
+ gr.Examples(examples, inputs=[input_image, model_dropdown], outputs=transcription_output)
108
 
109
  iface.launch()