import gradio as gr # Step 1: Textbox input # Define relation types and sample text rels = [ 'acronym', 'author', 'data description', 'data geography', 'data source', 'data type', 'publication year', 'publisher', 'reference year', 'version' ] sample_text = ( "Recent studies on ocean currents from the Global Ocean Temperature Dataset (GOTD) " "indicate significant shifts in marine biodiversity." ) # Dummy inference echoes input + relations def dummy_inference(query: str) -> str: # TODO: replace with actual NER+RE model inference return f"Model received: '{query}' with relations: {rels}" with gr.Blocks(title="Step 1: Input Box Demo") as demo: gr.Markdown( """ ## Step 1: Implement a Text Input Enter any text below (prepopulated with a sample). This is where your NER + relation-extraction model will later consume the query. """ ) query_input = gr.Textbox( lines=4, value=sample_text, label="Input Text", placeholder="Type your text here...", ) submit_btn = gr.Button("Submit") output_box = gr.Textbox( lines=3, label="Echoed Output", ) submit_btn.click( fn=dummy_inference, inputs=[query_input], outputs=[output_box], ) # Launch the demo if __name__ == "__main__": demo.queue(default_concurrency_limit=5) demo.launch(debug=True)