hong-xl commited on
Commit
73ff91d
β€’
1 Parent(s): 42d3cd3

update application file

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -20,10 +20,10 @@ def create_html_page(input_image):
20
  text = 'model output text'
21
  draw.text((0, image.height), text, fill=color)
22
  # ε°†εΈ¦ζœ‰ε›Ύη‰‡ε’Œζ–‡ζœ¬ηš„ HTML ι‘΅ι’θΏ”ε›ž
23
- output_html = '<img src="data:image/png;base64,{}">'.format(
24
- image.getvalue().encode('base64').decode())
25
- output_html += '<p>{}</p>'.format(text)
26
- return output_html
27
 
28
  # Create Gradio input and output components
29
  image_input = gr.inputs.Image(type='filepath', label="Input Image")
@@ -36,6 +36,6 @@ semantic_segment_device = gr.inputs.Radio(choices=['cuda', 'cpu'], default='cuda
36
  controlnet_device = gr.inputs.Radio(choices=['cuda', 'cpu'], default='cpu', label='ControlNet Device')
37
 
38
  # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
39
- iface = gr.Interface(fn=create_html_page, inputs=[image_input], outputs=["html"])
40
 
41
  iface.launch()
 
20
  text = 'model output text'
21
  draw.text((0, image.height), text, fill=color)
22
  # ε°†εΈ¦ζœ‰ε›Ύη‰‡ε’Œζ–‡ζœ¬ηš„ HTML ι‘΅ι’θΏ”ε›ž
23
+ # output_html = '<img src="data:image/png;base64,{}">'.format(
24
+ # draw.getvalue().encode('base64').decode())
25
+ # output_html += '<p>{}</p>'.format(text)
26
+ return draw
27
 
28
  # Create Gradio input and output components
29
  image_input = gr.inputs.Image(type='filepath', label="Input Image")
 
36
  controlnet_device = gr.inputs.Radio(choices=['cuda', 'cpu'], default='cpu', label='ControlNet Device')
37
 
38
  # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
39
+ iface = gr.Interface(fn=create_html_page, inputs=[image_input], outputs=["image"])
40
 
41
  iface.launch()