discus0434 commited on
Commit
e023f7e
·
verified ·
1 Parent(s): db58a82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -5
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import gradio as gr
2
  import torch
3
  from aesthetic_predictor_v2_5 import convert_v2_5_from_siglip
@@ -33,11 +35,29 @@ class AestheticPredictor:
33
  if __name__ == "__main__":
34
  aesthetic_predictor = AestheticPredictor()
35
  with gr.Blocks(theme="soft") as blocks:
36
- with gr.Column():
37
- image = gr.Image(label="Input Image", type="pil")
38
- button = gr.Button("Predict")
39
- score = gr.Textbox(label="Aesthetic Score")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- button.click(aesthetic_predictor.inference, inputs=image, outputs=score)
42
 
43
  blocks.queue().launch()
 
1
+ import inspect
2
+
3
  import gradio as gr
4
  import torch
5
  from aesthetic_predictor_v2_5 import convert_v2_5_from_siglip
 
35
  if __name__ == "__main__":
36
  aesthetic_predictor = AestheticPredictor()
37
  with gr.Blocks(theme="soft") as blocks:
38
+ markdown = gr.Markdown(
39
+ value=inspect.cleandoc(
40
+ """
41
+ # Aesthetic Predictor V2.5
42
+
43
+ This app predicts the aesthetic score of input images such as paintings,
44
+ photographs, and illustrations.
45
+
46
+ The aesthetic score is a floating-point number between 1 and 10.
47
+
48
+ 5.5+ is considered to be a good aesthetic score.
49
+ """
50
+ )
51
+ )
52
+
53
+ with gr.Row():
54
+ with gr.Column():
55
+ image = gr.Image(label="Input Image", type="pil")
56
+ button = gr.Button("Predict")
57
+
58
+ with gr.Column():
59
+ score = gr.Textbox(label="Aesthetic Score")
60
 
61
+ button.click(aesthetic_predictor.inference, inputs=image, outputs=score)
62
 
63
  blocks.queue().launch()