Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,11 @@ def display_df():
|
|
9 |
df_images = df.head(1000)
|
10 |
return df_images
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
def display_next1000(dataframe, end):
|
13 |
dataframe = dataframe.sample(frac=1)
|
14 |
start = (end or dataframe.index[-1]) + 1
|
@@ -16,20 +21,33 @@ def display_next1000(dataframe, end):
|
|
16 |
df_images = df.loc[start:end]
|
17 |
return df_images, end
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
with gr.Blocks() as demo:
|
21 |
gr.Markdown("<h1><center>🍰PrompTart🎨</center></h1>")
|
22 |
gr.Markdown("""<div align="center">Art Prompts from <a href = "https://playgroundai.com/">Playground</a>. <a href="https://github.com/playgroundai/liked_images">Git</a>. <a href="https://playgroundai.com/create">Create Art Here</a>. <a href="https://paperswithcode.com/datasets?q=art&v=lst&o=newest">Papers,Code,Datasets for SOTA in Art</a>""")
|
|
|
|
|
23 |
|
24 |
with gr.Row():
|
25 |
num_end = gr.Number(visible=False)
|
26 |
b1 = gr.Button("Images and Prompts 0-1000")
|
27 |
b2 = gr.Button("Next 1000 Images and Prompts")
|
28 |
|
|
|
|
|
|
|
|
|
29 |
with gr.Row():
|
30 |
out_dataframe = gr.Dataframe(wrap=True, max_rows=1000, overflow_row_behaviour= "paginate", datatype = ["markdown", "markdown"], headers=['url', 'prompt'])
|
31 |
|
32 |
b1.click(fn=display_df, outputs=out_dataframe)
|
33 |
b2.click(fn=display_next1000, inputs= [out_dataframe, num_end ], outputs=[out_dataframe, num_end])
|
|
|
34 |
|
35 |
demo.launch(debug=True, show_error=True)
|
|
|
9 |
df_images = df.head(1000)
|
10 |
return df_images
|
11 |
|
12 |
+
def display_df_search(search):
|
13 |
+
df_images = df.loc[df['prompt'].str.contains(search, case=False, na=False)]
|
14 |
+
#df_images = df.head(1000)
|
15 |
+
return df_images
|
16 |
+
|
17 |
def display_next1000(dataframe, end):
|
18 |
dataframe = dataframe.sample(frac=1)
|
19 |
start = (end or dataframe.index[-1]) + 1
|
|
|
21 |
df_images = df.loc[start:end]
|
22 |
return df_images, end
|
23 |
|
24 |
+
def Match(name):
|
25 |
+
pd.set_option("display.max_rows", None)
|
26 |
+
data = df
|
27 |
+
swith=data.loc[data['prompt'].str.contains(name, case=False, na=False)]
|
28 |
+
return swith
|
29 |
+
|
30 |
|
31 |
with gr.Blocks() as demo:
|
32 |
gr.Markdown("<h1><center>🍰PrompTart🎨</center></h1>")
|
33 |
gr.Markdown("""<div align="center">Art Prompts from <a href = "https://playgroundai.com/">Playground</a>. <a href="https://github.com/playgroundai/liked_images">Git</a>. <a href="https://playgroundai.com/create">Create Art Here</a>. <a href="https://paperswithcode.com/datasets?q=art&v=lst&o=newest">Papers,Code,Datasets for SOTA in Art</a>""")
|
34 |
+
|
35 |
+
|
36 |
|
37 |
with gr.Row():
|
38 |
num_end = gr.Number(visible=False)
|
39 |
b1 = gr.Button("Images and Prompts 0-1000")
|
40 |
b2 = gr.Button("Next 1000 Images and Prompts")
|
41 |
|
42 |
+
with gr.Row(): # inputs and buttons
|
43 |
+
inp = gr.Textbox(lines=1, default="", label="Search")
|
44 |
+
b3 = gr.Button("Search")
|
45 |
+
|
46 |
with gr.Row():
|
47 |
out_dataframe = gr.Dataframe(wrap=True, max_rows=1000, overflow_row_behaviour= "paginate", datatype = ["markdown", "markdown"], headers=['url', 'prompt'])
|
48 |
|
49 |
b1.click(fn=display_df, outputs=out_dataframe)
|
50 |
b2.click(fn=display_next1000, inputs= [out_dataframe, num_end ], outputs=[out_dataframe, num_end])
|
51 |
+
b3.click(fn=display_df_search, inputs=inp, outputs=out_dataframe)
|
52 |
|
53 |
demo.launch(debug=True, show_error=True)
|