Spaces:
Sleeping
Sleeping
import gradio as gr | |
def txt_to_text(txt_file_cmpt): | |
with open(txt_file_cmpt.name, 'r') as file: | |
content = file.read() | |
return content | |
with gr.Blocks() as demo: | |
with gr.Row(): | |
with gr.Column(variant='panel', scale=1): | |
txt_file_cmpt = gr.File(label="Select .txt File", file_count="single", file_types=[".txt"], | |
height=150) | |
with gr.Column(variant='panel', scale=4): | |
with gr.Row(): | |
with gr.Column(variant='panel'): | |
text_tbox = gr.Textbox(label=".txt Text", interactive=True, | |
info="Upload .pdf or paste in text. Shift-Enter to add a line") | |
txt_file_cmpt.change(txt_to_text, inputs=[txt_file_cmpt], | |
outputs=[text_tbox]) | |
demo.launch() |