toilaluan commited on
Commit
16508ee
1 Parent(s): 69bcda0
Files changed (4) hide show
  1. app.py +17 -3
  2. input_image.png +0 -0
  3. output_graph.png +0 -0
  4. scorer.py +1 -1
app.py CHANGED
@@ -60,9 +60,12 @@ Question: {questions}.
60
  Reward per question: {reward}"""
61
 
62
 
63
-
 
 
 
 
64
  description = """
65
- <p align="center">T2I Adherence Scorer based on Davidsonian Scene Graph</p>
66
  <p><center>
67
  <a href="https://arxiv.org/abs/2310.18235A" target="_blank">[Original Paper]</a>
68
  <a href="https://github.com/toilaluan" target="_blank">[My Github]</a>
@@ -71,13 +74,24 @@ description = """
71
  </center></p>
72
  """
73
 
 
 
 
 
 
 
 
 
74
  # Define the Gradio interface
75
  interface = gr.Interface(
76
  fn=process_image,
77
  inputs=[gr.Image(type="pil", label="Input Image"), gr.Textbox(label="Enter your prompt")],
78
  outputs=[gr.Image(type="pil", label="Graph Score Image", format="png"), gr.Textbox(label="Analyzed Result")],
79
  theme=gr.themes.Soft(),
80
- description=description
 
 
 
81
  )
82
 
83
  # Launch the Gradio app
 
60
  Reward per question: {reward}"""
61
 
62
 
63
+ gr.Markdown(
64
+ """
65
+ # T2I Adherence Scorer based on Davidsonian Scene Graph
66
+ """
67
+ )
68
  description = """
 
69
  <p><center>
70
  <a href="https://arxiv.org/abs/2310.18235A" target="_blank">[Original Paper]</a>
71
  <a href="https://github.com/toilaluan" target="_blank">[My Github]</a>
 
74
  </center></p>
75
  """
76
 
77
+ css = '''
78
+ #gen_btn{height: 100%}
79
+ #title{text-align: center}
80
+ #title h1{font-size: 3em; display:inline-flex; align-items:center}
81
+ #title img{width: 100px; margin-right: 0.5em}
82
+ #gallery .grid-wrap{height: 10vh}
83
+ '''
84
+
85
  # Define the Gradio interface
86
  interface = gr.Interface(
87
  fn=process_image,
88
  inputs=[gr.Image(type="pil", label="Input Image"), gr.Textbox(label="Enter your prompt")],
89
  outputs=[gr.Image(type="pil", label="Graph Score Image", format="png"), gr.Textbox(label="Analyzed Result")],
90
  theme=gr.themes.Soft(),
91
+ description=description,
92
+ examples = ["input_image.png", "a cute white cat with blue eyes is standing in the jungle"],
93
+ css=css,
94
+ cache_examples=True
95
  )
96
 
97
  # Launch the Gradio app
input_image.png ADDED
output_graph.png ADDED
scorer.py CHANGED
@@ -323,7 +323,7 @@ Each tuple contains the following information:
323
  self,
324
  questions: list[str],
325
  dependencies: dict[list],
326
- images: list[str],
327
  mode="hybrid",
328
  ):
329
  """Get reward for the generated questions use structured question graph.
 
323
  self,
324
  questions: list[str],
325
  dependencies: dict[list],
326
+ images: list,
327
  mode="hybrid",
328
  ):
329
  """Get reward for the generated questions use structured question graph.