Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -85,19 +85,20 @@ with gr.Blocks() as block_demo:
|
|
| 85 |
|
| 86 |
def refresh_comparison():
|
| 87 |
return get_random_comparison()
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
headers = request.headers
|
| 91 |
-
host = request.client.host
|
| 92 |
-
request_state = dict(headers)
|
| 93 |
-
request_state['host'] = host
|
| 94 |
-
else :
|
| 95 |
-
request_state = request_head
|
| 96 |
-
# print(str(request))
|
| 97 |
-
print(request_state)
|
| 98 |
image, method1, method2, image1, image2, property, image_input = refresh_comparison()
|
| 99 |
return image1, image2, f"<h2 style='font-size: 24px;'>Which one <mark class='red'>{property_dict[property]}</mark>?</h2>",\
|
| 100 |
-
image, method1, method2, property, image_input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
gr.Markdown("<h2 align='center',style='font-size: 24px;'>Low-light Image Enhancer Arena 🥊</h2>")
|
| 102 |
gr.Markdown("<p align='center', style='font-size: 18px;'>LIME-Eval is an arena to ask human-beings to judge the performance of different low-light image enhancers with respect to </p>")
|
| 103 |
gr.Markdown("<p align='center', style='font-size: 18px;'>different factors, including Artifact, Color Degradation, Noise, Poor Illumination, Blur, and Overall quality.</p>")
|
|
@@ -121,7 +122,7 @@ with gr.Blocks() as block_demo:
|
|
| 121 |
|
| 122 |
prop_text = gr.Markdown(f'###Which one is better in terms of x?')
|
| 123 |
image_state, method1_state, method2_state, property_state, ip_state = gr.State(), gr.State(), gr.State(), gr.State(), gr.State()
|
| 124 |
-
block_demo.load(on_load, inputs=[
|
| 125 |
image_state, method1_state, method2_state, property_state, img_input, ip_state])
|
| 126 |
with gr.Row():
|
| 127 |
l_butt = gr.Button("Image 1")
|
|
|
|
| 85 |
|
| 86 |
def refresh_comparison():
|
| 87 |
return get_random_comparison()
|
| 88 |
+
|
| 89 |
+
def prepare_everything_else():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
image, method1, method2, image1, image2, property, image_input = refresh_comparison()
|
| 91 |
return image1, image2, f"<h2 style='font-size: 24px;'>Which one <mark class='red'>{property_dict[property]}</mark>?</h2>",\
|
| 92 |
+
image, method1, method2, property, image_input
|
| 93 |
+
def on_load(request, request_head=None):
|
| 94 |
+
|
| 95 |
+
headers = request.headers
|
| 96 |
+
host = request.client.host
|
| 97 |
+
request_state = dict(headers)
|
| 98 |
+
request_state['host'] = host
|
| 99 |
+
|
| 100 |
+
return **prepare_everything_else(), request_state
|
| 101 |
+
|
| 102 |
gr.Markdown("<h2 align='center',style='font-size: 24px;'>Low-light Image Enhancer Arena 🥊</h2>")
|
| 103 |
gr.Markdown("<p align='center', style='font-size: 18px;'>LIME-Eval is an arena to ask human-beings to judge the performance of different low-light image enhancers with respect to </p>")
|
| 104 |
gr.Markdown("<p align='center', style='font-size: 18px;'>different factors, including Artifact, Color Degradation, Noise, Poor Illumination, Blur, and Overall quality.</p>")
|
|
|
|
| 122 |
|
| 123 |
prop_text = gr.Markdown(f'###Which one is better in terms of x?')
|
| 124 |
image_state, method1_state, method2_state, property_state, ip_state = gr.State(), gr.State(), gr.State(), gr.State(), gr.State()
|
| 125 |
+
block_demo.load(on_load, inputs=[], outputs=[img1, img2, prop_text,
|
| 126 |
image_state, method1_state, method2_state, property_state, img_input, ip_state])
|
| 127 |
with gr.Row():
|
| 128 |
l_butt = gr.Button("Image 1")
|