Kjgarza commited on
Commit
229269d
·
1 Parent(s): a5381f1
Files changed (1) hide show
  1. app.py +37 -2
app.py CHANGED
@@ -3,5 +3,40 @@ import gradio as gr
3
  def greet(name):
4
  return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  def greet(name):
4
  return "Hello " + name + "!!"
5
 
6
+ def create_input_components():
7
+ """
8
+ Creates and returns input components for Gradio interface.
9
+ """
10
+ # A text area for users to input or paste the schema file.
11
+ schema_input = gr.Textbox(label="Schema File", placeholder="Paste your schema here...")
12
+
13
+ # A text input for users to provide the schema target.
14
+ target_input = gr.Input(label="Schema Target", placeholder="Enter your schema target...")
15
+
16
+ return schema_input, target_input
17
+
18
+ def create_output_component():
19
+ """
20
+ Creates and returns output component for Gradio interface.
21
+ """
22
+ # A text area to display the transformed schema output.
23
+ transformed_schema_output = gr.Textbox(label="Transformed Schema", readonly=True)
24
+
25
+ return transformed_schema_output
26
+
27
+ # Prepare the UI components.
28
+ inputs = create_input_components()
29
+ output = create_output_component()
30
+
31
+ # Define the Gradio interface.
32
+ interface = gr.Interface(
33
+ fn=greet, # This function will handle the logic and transformations.
34
+ inputs=inputs,
35
+ outputs=output,
36
+ # live=True,
37
+ title="Schema Transformer with Llama2",
38
+ description="Paste your schema, specify the target, and get the transformed schema."
39
+ )
40
+
41
+ # Launch the Gradio web interface.
42
+ interface.launch()