Spaces:
Paused
Paused
import gradio as gr | |
# Define a function to process the selected file and input text | |
def process_file_and_text(file_path, input_text): | |
# Perform some operation using the file path and input text | |
with open(file_path, 'r') as file: | |
file_content = file.read() | |
# Combine the file content and input text | |
result = f"File Content:\n{file_content}\n\nInput Text:\n{input_text}" | |
return result | |
# Create Gradio components for file dropdown, input text box, and output text box | |
file_dropdown = gr.inputs.File(label="Select a file") | |
input_text = gr.inputs.Textbox(label="Enter some text") | |
output_text = gr.outputs.Textbox(label="Processed Result") | |
# Define the Gradio interface | |
demo = gr.Interface( | |
fn=process_file_and_text, | |
inputs=[file_dropdown, input_text], | |
outputs=output_text, | |
title="File Dropdown with Input Text Demo", | |
description="Select a file, enter text, and view the processed result" | |
) | |
# Launch the Gradio app | |
demo.launch() |