Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -440,7 +440,8 @@ with gr.Blocks(css=css) as demo:
|
|
440 |
#
|
441 |
###################################
|
442 |
|
443 |
-
|
|
|
444 |
def _search_datasets(search_query):
|
445 |
yield {generated_texts_state: []}
|
446 |
yield {
|
@@ -476,6 +477,25 @@ with gr.Blocks(css=css) as demo:
|
|
476 |
}
|
477 |
current_item_idx += 1
|
478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
|
480 |
@search_button.click(inputs=search_bar, outputs=button_groups + buttons + [generated_texts_state])
|
481 |
def search_dataset_from_search_button(search_query):
|
|
|
440 |
#
|
441 |
###################################
|
442 |
|
443 |
+
|
444 |
+
|
445 |
def _search_datasets(search_query):
|
446 |
yield {generated_texts_state: []}
|
447 |
yield {
|
|
|
477 |
}
|
478 |
current_item_idx += 1
|
479 |
|
480 |
+
with gr.Row():
|
481 |
+
search_bar = gr.Textbox(max_lines=1, placeholder="Search datasets, get infinite results", show_label=False, container=False, scale=9)
|
482 |
+
search_button = gr.Button("🔍", variant="primary", scale=1)
|
483 |
+
|
484 |
+
# Add File Upload Component
|
485 |
+
with gr.Row():
|
486 |
+
file_input = gr.File(label="Upload a large file", type="file", file_count="single")
|
487 |
+
process_button = gr.Button("Process File") # Button to process the file
|
488 |
+
output_text = gr.Textbox(label="Output") # Output area for processed result
|
489 |
+
|
490 |
+
# Define the file processing function
|
491 |
+
def handle_uploaded_file(file):
|
492 |
+
with open(file.name, 'rb') as f:
|
493 |
+
content = f.read() # Read the file content
|
494 |
+
return f"Processed {len(content)} bytes from the file."
|
495 |
+
|
496 |
+
# Connect the button to the file processing function
|
497 |
+
process_button.click(fn=handle_uploaded_file, inputs=file_input, outputs=output_text)
|
498 |
+
|
499 |
|
500 |
@search_button.click(inputs=search_bar, outputs=button_groups + buttons + [generated_texts_state])
|
501 |
def search_dataset_from_search_button(search_query):
|