Skip to content

Commit

Permalink
feat(frontend): support init frontend (#559)
Browse files Browse the repository at this point in the history
* set lock

* fix pre-commit error

* change idea to proposal

* fix mypy errror

* fix pre-commit errror

* update poetry lock
  • Loading branch information
lwaekfjlk authored Sep 11, 2024
1 parent 059180a commit c918aca
Show file tree
Hide file tree
Showing 3 changed files with 769 additions and 9 deletions.
27 changes: 27 additions & 0 deletions frontend/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from typing import List

import gradio as gr


def get_proposals() -> List[str]:
return ['idea 1', 'idea 2', 'idea 3']


with gr.Blocks() as demo:
input_text = gr.Textbox(label='input')
mode = gr.Radio(['textbox', 'button'], value='textbox')

@gr.render(inputs=[input_text, mode], triggers=[input_text.submit]) # type: ignore
def show_ideas(text, mode):
if len(text) == 0:
gr.Markdown('## No arxiv link provided')
else:
proposals = get_proposals()
for proposal in proposals:
if mode == 'textbox':
gr.Textbox(proposal)
else:
gr.Button(proposal)


demo.launch()
Loading

0 comments on commit c918aca

Please sign in to comment.