Spaces:
Sleeping
Sleeping
File size: 861 Bytes
b146e73 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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() |