Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -59,30 +59,36 @@ def evaluate_caption(image, caption):
|
|
59 |
# ,gr.Image(type="pil", value="mukherjee_kushin_WIDPICS1.jpg")
|
60 |
|
61 |
callback = gr.HuggingFaceDatasetSaver('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', "gradioTest")
|
62 |
-
|
|
|
63 |
gr.Markdown(
|
64 |
"""
|
65 |
# Welcome to our Human vs. AI game!
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
""")
|
71 |
-
im_path_str = '
|
|
|
|
|
72 |
im_path = gr.Textbox(label="Image fname",value=im_path_str,interactive=False, visible=False)
|
73 |
# fn=evaluate_caption,
|
74 |
# inputs=["image", "text"]
|
75 |
-
|
76 |
-
|
77 |
-
with gr.
|
78 |
-
im = gr.Image(label="Target Image", interactive = False, type="pil",value =os.path.join(im_dir,im_path_str),height=
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
81 |
# outputs=["text","text"],
|
82 |
-
with gr.
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
|
87 |
|
88 |
# live=False,
|
@@ -95,4 +101,4 @@ with gr.Blocks() as demo:
|
|
95 |
# btn = gr.Button("Flag")
|
96 |
# btn.click(lambda *args: callback.flag(args), [im, caps, out1, out2], None, preprocess=False)
|
97 |
|
98 |
-
demo.launch()
|
|
|
59 |
# ,gr.Image(type="pil", value="mukherjee_kushin_WIDPICS1.jpg")
|
60 |
|
61 |
callback = gr.HuggingFaceDatasetSaver('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', "gradioTest")
|
62 |
+
|
63 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
64 |
gr.Markdown(
|
65 |
"""
|
66 |
# Welcome to our Human vs. AI game!
|
67 |
+
|
68 |
+
You and an AI agent are trying to convince a third AI agent that each of you are better at describing the visual world. \n
|
69 |
+
In order to win, describe this image in one sentence. Then the second AI agent will also generate a description and the third agent will decide a winner.
|
70 |
+
You win if the AI says that "Player 1 wins!"
|
71 |
""")
|
72 |
+
# im_path_str = 'n03418158_2886.JPEG'
|
73 |
+
im_path_str = random.choice(os.listdir(im_dir))
|
74 |
+
|
75 |
im_path = gr.Textbox(label="Image fname",value=im_path_str,interactive=False, visible=False)
|
76 |
# fn=evaluate_caption,
|
77 |
# inputs=["image", "text"]
|
78 |
+
|
79 |
+
|
80 |
+
with gr.Row():
|
81 |
+
im = gr.Image(label="Target Image", interactive = False, type="pil",value =os.path.join(im_dir,im_path_str),height=400)
|
82 |
+
with gr.Column():
|
83 |
+
caps = gr.Textbox(label="Player 1 Caption")
|
84 |
+
submit_btn = gr.Button("Submit!!")
|
85 |
+
out1 = gr.Textbox(label="Player 2 (Machine) Caption",interactive=False)
|
86 |
+
|
87 |
# outputs=["text","text"],
|
88 |
+
with gr.Row():
|
89 |
+
with gr.Column():
|
90 |
+
out2 = gr.Textbox(label="Winner",interactive=False)
|
91 |
+
reload_btn = gr.Button("Next Image")
|
92 |
|
93 |
|
94 |
# live=False,
|
|
|
101 |
# btn = gr.Button("Flag")
|
102 |
# btn.click(lambda *args: callback.flag(args), [im, caps, out1, out2], None, preprocess=False)
|
103 |
|
104 |
+
demo.launch()
|