Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -28,10 +28,9 @@ def process_ocr(document_source, api_key):
|
|
28 |
)
|
29 |
|
30 |
def do_ocr(input_type, url, file, api_key):
|
31 |
-
# Check UI-provided API key first, then fall back to environment variable
|
32 |
api_key = api_key.strip() if api_key and api_key.strip() else os.environ.get("MISTRAL")
|
33 |
if not api_key:
|
34 |
-
return "Please provide a valid Mistral API key
|
35 |
|
36 |
document_source = None
|
37 |
|
@@ -113,9 +112,9 @@ with gr.Blocks(
|
|
113 |
css=custom_css,
|
114 |
theme=gr.themes.Soft()
|
115 |
) as demo:
|
116 |
-
gr.Markdown("<h1 style='text-align: center;
|
117 |
-
gr.Markdown("<p style='text-align: center;
|
118 |
-
gr.Markdown("<p style='text-align: center;
|
119 |
|
120 |
with gr.Row():
|
121 |
with gr.Column(scale=1):
|
|
|
28 |
)
|
29 |
|
30 |
def do_ocr(input_type, url, file, api_key):
|
|
|
31 |
api_key = api_key.strip() if api_key and api_key.strip() else os.environ.get("MISTRAL")
|
32 |
if not api_key:
|
33 |
+
return "Please provide a valid Mistral API key", "", []
|
34 |
|
35 |
document_source = None
|
36 |
|
|
|
112 |
css=custom_css,
|
113 |
theme=gr.themes.Soft()
|
114 |
) as demo:
|
115 |
+
gr.Markdown("<h1 style='text-align: center;'>Mistral OCR Demo</h1>")
|
116 |
+
gr.Markdown("<p style='text-align: center;'>Extract text and images from PDFs or images using Mistral's latest OCR model. Visit <a href='https://console.mistral.ai/'>Mistral AI Console</a> to manage your API key. You can also see markdown live.</p>")
|
117 |
+
gr.Markdown("<p style='text-align: center;'>Provide your Mistral API key below or set the MISTRAL as secret from space settings.</p>")
|
118 |
|
119 |
with gr.Row():
|
120 |
with gr.Column(scale=1):
|