DSatishchandra commited on
Commit
37746c7
·
verified ·
1 Parent(s): 25e092e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Placeholder function for PO extraction
4
+ # Replace this with the actual logic for processing the selected format
5
+ def process_format(format_name):
6
+ # Simulated logic for different formats
7
+ if format_name == "BHEL.py":
8
+ return "Processing in BHEL.py format..."
9
+ elif format_name == "Federal Electric.py":
10
+ return "Processing in Federal Electric.py format..."
11
+ elif format_name == "AL-NISF":
12
+ return "Processing in AL-NISF format..."
13
+ else:
14
+ return "Unknown format selected."
15
+
16
+ # Define the dropdown options
17
+ format_options = ["BHEL.py", "Federal Electric.py", "AL-NISF"]
18
+
19
+ # Build the Gradio app
20
+ def app():
21
+ dropdown = gr.Dropdown(
22
+ choices=format_options,
23
+ label="Select Format",
24
+ value="BHEL.py", # Default value
25
+ interactive=True,
26
+ )
27
+
28
+ output = gr.Textbox(label="Result", interactive=False)
29
+
30
+ # Update function to display result based on selected format
31
+ def update(format_name):
32
+ return process_format(format_name)
33
+
34
+ interface = gr.Interface(
35
+ fn=update,
36
+ inputs=dropdown,
37
+ outputs=output,
38
+ title="PO Extraction Format Selector",
39
+ description="Select the desired format from the dropdown, and the app will process accordingly."
40
+ )
41
+
42
+ return interface
43
+
44
+ if __name__ == "__main__":
45
+ app().launch()