freddyaboulton's picture
Update app.py
8f83b97
raw
history blame contribute delete
755 Bytes
import gradio as gr
from gradio_textwithattachments import TextWithAttachments
from gradio_textwithattachments.textwithattachments import TextWithAttachmentsData
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
text = TextWithAttachments()
with gr.Column():
with gr.Row():
message = gr.Textbox()
files = gr.Files(file_count="multiple")
with gr.Row():
json_outout = gr.JSON()
@gr.on(
[text.file_upload, text.text_submit],
inputs=[text],
outputs=[message, files, json_outout])
def update(data: TextWithAttachmentsData):
return data.text, [f.name for f in data.attachments], data
demo.launch()