Spaces:
Sleeping
Sleeping
wjbmattingly
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -88,16 +88,31 @@ examples = [
|
|
88 |
[f"{base_url}textualis-3.png", "Medieval Textualis"],
|
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 |
-
|
98 |
-
|
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 |
|
|
|
88 |
[f"{base_url}textualis-3.png", "Medieval Textualis"],
|
89 |
]
|
90 |
|
91 |
+
# Custom CSS to make the image wider
|
92 |
+
custom_css = """
|
93 |
+
#image_upload {
|
94 |
+
max-width: 100% !important;
|
95 |
+
width: 100% !important;
|
96 |
+
height: auto !important;
|
97 |
+
}
|
98 |
+
#image_upload > div:first-child {
|
99 |
+
width: 100% !important;
|
100 |
+
}
|
101 |
+
#image_upload img {
|
102 |
+
max-width: 100% !important;
|
103 |
+
width: 100% !important;
|
104 |
+
height: auto !important;
|
105 |
+
}
|
106 |
+
"""
|
107 |
+
|
108 |
# Gradio interface
|
109 |
+
with gr.Blocks(css=custom_css) as iface:
|
110 |
gr.Markdown("# Medieval TrOCR Model Switcher")
|
111 |
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.")
|
112 |
|
113 |
with gr.Row():
|
114 |
+
input_image = gr.Image(type="pil", label="Input Image", elem_id="image_upload")
|
115 |
+
model_dropdown = gr.Dropdown(choices=list(MODEL_OPTIONS.keys()), label="Select Model", value="Medieval Base")
|
|
|
|
|
116 |
|
117 |
transcription_output = gr.Textbox(label="Transcription")
|
118 |
|