LuisV commited on
Commit
a0bdbeb
·
1 Parent(s): 37e3fce

first version of the interface

Browse files
Files changed (1) hide show
  1. app.py +39 -1
app.py CHANGED
@@ -64,9 +64,47 @@ def caption_artwork(
64
 
65
  return (emotion_str, colors_str, objects_str, commentary_str)
66
 
 
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  def greet(name):
69
  return "Hello " + name + "!!"
70
 
71
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
72
- iface.launch()
 
 
 
 
64
 
65
  return (emotion_str, colors_str, objects_str, commentary_str)
66
 
67
+ with gr.Blocks() as demo:
68
 
69
+ with gr.Column():
70
+ gr.HTML("""
71
+ <h2 style="text-align: center;">
72
+ LLMs talk about art!
73
+ </h2>
74
+ <p style="text-align: center;"></p>
75
+ """)
76
+ gr_image = gr.Image(value="./1665_Girl_with_a_Pearl_Earring.jpg")
77
+
78
+
79
+ gr_emotion = gr.Textbox(
80
+ label="Evoked emotion: "
81
+ )
82
+ gr_colors = gr.Textbox(
83
+ label = "Main colors: "
84
+ )
85
+ gr_objects = gr.Textbox(
86
+ label = "Main objects present: "
87
+ )
88
+
89
+ gr_commentary = gr.Textbox(
90
+ label="Commentary on the artwork:",
91
+ )
92
+
93
+
94
+
95
+ btn = gr.Button(value="Submit your image!")
96
+ btn.click(
97
+ caption_artwork,
98
+ inputs=[gr_image],
99
+ outputs=[gr_emotion, gr_colors, gr_objects, gr_commentary]
100
+ )
101
+
102
+ """
103
  def greet(name):
104
  return "Hello " + name + "!!"
105
 
106
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
107
+ iface.launch()
108
+ """
109
+ if __name__ == "__main__":
110
+ demo.launch(allowed_paths = [os.path.dirname(__file__)])