Nandyala commited on
Commit
e62ffb3
1 Parent(s): ce4c9bf

created first app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Define a function to process the selected file and input text
4
+ def process_file_and_text(file_path, input_text):
5
+ # Perform some operation using the file path and input text
6
+ with open(file_path, 'r') as file:
7
+ file_content = file.read()
8
+
9
+ # Combine the file content and input text
10
+ result = f"File Content:\n{file_content}\n\nInput Text:\n{input_text}"
11
+
12
+ return result
13
+
14
+ # Create Gradio components for file dropdown, input text box, and output text box
15
+ file_dropdown = gr.inputs.File(label="Select a file")
16
+ input_text = gr.inputs.Textbox(label="Enter some text")
17
+ output_text = gr.outputs.Textbox(label="Processed Result")
18
+
19
+ # Define the Gradio interface
20
+ demo = gr.Interface(
21
+ fn=process_file_and_text,
22
+ inputs=[file_dropdown, input_text],
23
+ outputs=output_text,
24
+ title="File Dropdown with Input Text Demo",
25
+ description="Select a file, enter text, and view the processed result"
26
+ )
27
+
28
+ # Launch the Gradio app
29
+ demo.launch()