openreviewer / app.py
maxidl's picture
a
2fa3ca7
raw
history blame
1.51 kB
import gradio as gr
title = "# Paper Review Generator"
steps = """1. Converts uploaded pdf file to markdown. You can edit the intermediate markdown output.\n2. Generates a review for the paper"""
def generate(paper_text):
return "Success"
with gr.Blocks() as demo:
title = gr.Markdown(title)
steps = gr.Markdown(steps)
instr = gr.Markdown("## Upload your paper as a pdf file")
file_input = gr.File(file_types=[".pdf"], file_count="single")
markdown_field = gr.Textbox(label="Markdown", max_lines=20, autoscroll=False)
# generate_button = gr.Button("Generate Review", interactive=not markdown_field)
generate_button = gr.Button("Generate Review")
file_input.upload(process_file, file_input, markdown_field)
# markdown_field.change(lambda text: gr.update(interactive=True) if len(text) > 1000 else gr.update(interactive=False), markdown_field, generate_button)
review_field = gr.Markdown(label="Review")
# generate_button.click(fn=lambda: gr.update(interactive=False), inputs=None, outputs=generate_button).then(generate, markdown_field, review_field).then(fn=lambda: gr.update(interactive=True), inputs=None, outputs=generate_button)
generate_button.click(fn=lambda: gr.update(interactive=False), inputs=None, outputs=generate_button).then(generate, markdown_field, review_field).then(fn=lambda: gr.update(interactive=True), inputs=None, outputs=generate_button)
demo.title = "Paper Review Generator"
if __name__ == "__main__":
demo.launch()