import gradio as gr import metadata_transformer def greet(name): return "Hello " + name + "!!" def create_input_components(): """ Creates and returns input components for Gradio interface. """ # A text area for users to input or paste the schema file. schema_input = gr.TextArea(label="Schema File", placeholder="Paste your schema here...") # A text input for users to provide the schema target. target_input = gr.Textbox(label="Schema Target", placeholder="Enter your schema target...") file_input = """{}""".format(schema_input) return [file_input, target_input] def create_output_component(): """ Creates and returns output component for Gradio interface. """ # A text area to display the transformed schema output. transformed_schema_output = gr.Textbox(label="Transformed Schema", readonly=True) return transformed_schema_output # Prepare the UI components. inputs = create_input_components() output = create_output_component() # Define the Gradio interface. interface = gr.Interface( fn=metadata_transformer.translate, # This function will handle the logic and transformations. inputs=inputs, outputs="text", # live=True, title="Schema Transformer with Llama2", description="Paste your schema, specify the target, and get the transformed schema." ) # Launch the Gradio web interface. interface.launch()