Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,36 +62,9 @@ def reject(prompt, negative_prompt, seed, randomize_seed, width, height, guidanc
|
|
62 |
|
63 |
|
64 |
@spaces.GPU
|
65 |
-
def accept(
|
66 |
|
67 |
-
|
68 |
-
conv_id_element.visible=True
|
69 |
-
'''
|
70 |
-
markdown_blocks = list(args[1:-2])
|
71 |
-
labels = args[-2]
|
72 |
-
|
73 |
-
data = {'conv_id': conv_id, 'labels': labels}
|
74 |
-
with open(f"./labels/conv_{conv_id}", 'w') as f:
|
75 |
-
json.dump(data, f, indent=4)
|
76 |
-
|
77 |
-
new_conversation = get_conversation()
|
78 |
-
new_conv_id = new_conversation['conv_id']
|
79 |
-
new_transcript = pad_transcript(new_conversation['transcript'], max_conversation_length)
|
80 |
-
|
81 |
-
for i in range(max_conversation_length):
|
82 |
-
if new_transcript[i]['speaker'] != '':
|
83 |
-
markdown_blocks[i] = gr.Markdown(f"""<br>**{new_transcript[i]['speaker']}**: {new_transcript[i]['response']}""",
|
84 |
-
visible=True)
|
85 |
-
else:
|
86 |
-
markdown_blocks[i] = gr.Markdown("", visible=False)
|
87 |
-
|
88 |
-
new_labels = gr.CheckboxGroup(choices=checkbox_choices,
|
89 |
-
label="",
|
90 |
-
visible=False)
|
91 |
-
conv_len = gr.Number(value=len(new_transcript), visible=False)
|
92 |
-
|
93 |
-
return [new_conv_id] + list(markdown_blocks) + [labels] + [new_labels] + [conv_len]
|
94 |
-
'''
|
95 |
|
96 |
|
97 |
examples = [
|
@@ -134,7 +107,7 @@ with gr.Blocks(css=css) as demo:
|
|
134 |
right_button = gr.Button("Right", scale=0)
|
135 |
|
136 |
result = gr.Image(label="Result", show_label=False)
|
137 |
-
conv_id_element = gr.Text(value=
|
138 |
|
139 |
with gr.Accordion("Advanced Settings", open=False):
|
140 |
|
@@ -204,7 +177,7 @@ with gr.Blocks(css=css) as demo:
|
|
204 |
|
205 |
right_button.click(
|
206 |
fn = accept,
|
207 |
-
inputs = [
|
208 |
outputs = [conv_id_element]
|
209 |
)
|
210 |
|
|
|
62 |
|
63 |
|
64 |
@spaces.GPU
|
65 |
+
def accept(textOutput):
|
66 |
|
67 |
+
return gr.Text.update(visible=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
|
70 |
examples = [
|
|
|
107 |
right_button = gr.Button("Right", scale=0)
|
108 |
|
109 |
result = gr.Image(label="Result", show_label=False)
|
110 |
+
conv_id_element = gr.Text(value="Hello", visible=False)
|
111 |
|
112 |
with gr.Accordion("Advanced Settings", open=False):
|
113 |
|
|
|
177 |
|
178 |
right_button.click(
|
179 |
fn = accept,
|
180 |
+
inputs = [right_button],
|
181 |
outputs = [conv_id_element]
|
182 |
)
|
183 |
|