chore: clean up main
Browse files- app/{main_old.py → archive_main_old.py} +0 -0
- app/main_modal.py +0 -37
app/{main_old.py → archive_main_old.py}
RENAMED
File without changes
|
app/main_modal.py
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from gradio_modal import Modal
|
3 |
-
import numpy as np
|
4 |
-
|
5 |
-
def save_input(input, df):
|
6 |
-
#input_value = str(input)
|
7 |
-
df_values = np.array(df) # handle empty dataframe case
|
8 |
-
new_row = [input, 0, input] # default 'age' as 0 for now
|
9 |
-
df_values = np.vstack([df_values, new_row])
|
10 |
-
df = gr.DataFrame(value=df_values)
|
11 |
-
return df
|
12 |
-
|
13 |
-
with gr.Blocks() as demo:
|
14 |
-
with gr.Tab("Tab 1"):
|
15 |
-
show_btn = gr.Button("Show Modal")
|
16 |
-
df = gr.Dataframe(
|
17 |
-
headers=["name", "age", "gender"],
|
18 |
-
#datatype=["str", "number", "str"],
|
19 |
-
row_count=1,
|
20 |
-
col_count=(3, "fixed"),
|
21 |
-
)
|
22 |
-
show_markdown = gr.Markdown("This is a markdown")
|
23 |
-
with Modal(visible=False) as modal:
|
24 |
-
input = gr.Textbox(label="Input 1", interactive=True)
|
25 |
-
button = gr.Button("Click me")
|
26 |
-
button.click(save_input,
|
27 |
-
inputs=[input, df],
|
28 |
-
outputs=[df])
|
29 |
-
button.click(lambda: Modal(visible=False), None, modal)
|
30 |
-
show_btn.click(lambda: Modal(visible=True), None, modal)
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
if __name__ == "__main__":
|
37 |
-
demo.launch(server_name="0.0.0.0", server_port=3333)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|