|
|
|
import logging |
|
import json |
|
import gradio as gr |
|
|
|
log_format = "[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s" |
|
logging.basicConfig(level=logging.INFO, format=log_format) |
|
logger = logging.getLogger() |
|
|
|
|
|
def api_classification(url): |
|
logger.info(f'api_classification({url})') |
|
data = {"status":"WorkInProgress"} |
|
return json.dumps(data) |
|
|
|
|
|
with gr.Blocks() as app: |
|
with gr.Tab("BioCLIP API"): |
|
with gr.Row(): |
|
with gr.Column(): |
|
api_input = gr.Textbox( |
|
placeholder="Image url here", |
|
lines=1, |
|
label="Image url", |
|
show_label=True, |
|
info="Add image url here.", |
|
) |
|
api_classification_btn = gr.Button("API", variant="primary") |
|
with gr.Column(): |
|
api_classification_output = gr.JSON() |
|
|
|
|
|
api_classification_btn.click( |
|
fn=api_classification, |
|
inputs=[api_input], |
|
outputs=[api_classification_output], |
|
) |
|
app.queue(max_size=20) |
|
app.launch() |
|
|