DasperMansfield commited on
Commit
e61d737
·
verified ·
1 Parent(s): 9e4ebb4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -0
app.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Define the main function for the app
4
+ def main_function(purpose, help_text, export_text, extra_menu_item, chat_input, tts_input, script_input):
5
+ # Placeholder function to demonstrate the app
6
+ return {
7
+ "purpose_output": purpose,
8
+ "help_output": help_text,
9
+ "export_output": export_text,
10
+ "extra_menu_output": extra_menu_item,
11
+ "chat_output": chat_input,
12
+ "tts_output": tts_input,
13
+ "script_output": script_input
14
+ }
15
+
16
+ # Define the Gradio app
17
+ with gr.Blocks() as demo:
18
+ # Define input components
19
+ purpose_input = gr.Textbox(label="Purpose")
20
+ help_input = gr.Textbox(label="Help Text")
21
+ export_input = gr.Textbox(label="Export Text")
22
+ extra_menu_input = gr.Textbox(label="Extra Menu Item")
23
+ chat_input = gr.Textbox(label="Chat Input")
24
+ tts_input = gr.Textbox(label="TTS Input")
25
+ script_input = gr.Textbox(label="Script Input")
26
+
27
+ # Define output components
28
+ purpose_output = gr.Textbox(label="Purpose Output")
29
+ help_output = gr.Textbox(label="Help Output")
30
+ export_output = gr.Textbox(label="Export Output")
31
+ extra_menu_output = gr.Textbox(label="Extra Menu Output")
32
+ chat_output = gr.Textbox(label="Chat Output")
33
+ tts_output = gr.Textbox(label="TTS Output")
34
+ script_output = gr.Textbox(label="Script Output")
35
+
36
+ # Define the button to trigger the function
37
+ submit_button = gr.Button("Submit", variant="primary")
38
+
39
+ # Set up the event listener for the button
40
+ submit_button.click(
41
+ fn=main_function,
42
+ inputs=[purpose_input, help_input, export_input, extra_menu_input, chat_input, tts_input, script_input],
43
+ outputs=[purpose_output, help_output, export_output, extra_menu_output, chat_output, tts_output, script_output]
44
+ )
45
+
46
+ # Launch the app with custom colors
47
+ demo.launch(css="""
48
+ .gr-button-primary {
49
+ background-color: #4CAF50; /* Green */
50
+ color: white;
51
+ }
52
+ .gr-textbox {
53
+ background-color: #f0f0f0; /* Light Gray */
54
+ color: #333;