raja5259 commited on
Commit
17bead0
·
verified ·
1 Parent(s): 71c2a66

update app output as gallery

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -1,18 +1,24 @@
1
-
2
-
3
  import s23_openai_clip
4
  import gradio as gr
5
 
6
 
 
 
 
 
7
  _, valid_df = make_train_valid_dfs()
8
  model, image_embeddings = get_image_embeddings(valid_df, "best.pt")
9
 
10
- query_text = "dogs on the grass"
11
 
12
 
13
  def greet(query_text):
14
- return inference_CLIP(query_text)
15
 
16
 
17
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
18
  demo.launch("debug")
 
 
 
1
  import s23_openai_clip
2
  import gradio as gr
3
 
4
 
5
+ # query_text = "dogs on the grass"
6
+ image_path = "./Images"
7
+
8
+ !unzip flickr8k.zip
9
  _, valid_df = make_train_valid_dfs()
10
  model, image_embeddings = get_image_embeddings(valid_df, "best.pt")
11
 
 
12
 
13
 
14
  def greet(query_text):
15
+ return inference_CLIP2(query_text)
16
 
17
 
18
+ gallery = gr.Gallery(
19
+ label="Generated images", show_label=True, elem_id="gallery",
20
+ columns=[3], rows=[3], object_fit="contain", height="auto")
21
+ # btn = gr.Button("Generate images", scale=0)
22
+ demo = gr.Interface(fn=greet, inputs="text",
23
+ outputs=gallery)
24
  demo.launch("debug")