|
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. |
|
""" |
|
|
|
schema_input = gr.TextArea(label="Schema File", placeholder="Paste your schema here...") |
|
|
|
|
|
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. |
|
""" |
|
|
|
transformed_schema_output = gr.Textbox(label="Transformed Schema", readonly=True) |
|
|
|
return transformed_schema_output |
|
|
|
|
|
inputs = create_input_components() |
|
output = create_output_component() |
|
|
|
|
|
interface = gr.Interface( |
|
fn=metadata_transformer.translate, |
|
inputs=inputs, |
|
outputs="text", |
|
|
|
title="Schema Transformer with Llama2", |
|
description="Paste your schema, specify the target, and get the transformed schema." |
|
) |
|
|
|
|
|
interface.launch() |