Spaces:
Sleeping
Sleeping
Update: Refactor random text
Browse files
app.py
CHANGED
|
@@ -134,7 +134,7 @@ def predict(review: str):
|
|
| 134 |
|
| 135 |
##################################################################################
|
| 136 |
|
| 137 |
-
def
|
| 138 |
return random.choice(EXAMPLES)
|
| 139 |
|
| 140 |
def get_device_info():
|
|
@@ -158,7 +158,7 @@ with gr.Blocks() as demo:
|
|
| 158 |
label="Whisky Review (English only)",
|
| 159 |
lines=8,
|
| 160 |
placeholder="Enter whisky review",
|
| 161 |
-
value=
|
| 162 |
)
|
| 163 |
with gr.Row():
|
| 164 |
replace_btn = gr.Button("Load Example", variant="secondary", scale=1)
|
|
@@ -170,6 +170,6 @@ with gr.Blocks() as demo:
|
|
| 170 |
|
| 171 |
# Events
|
| 172 |
submit_btn.click(predict, inputs=review_box, outputs=[html_out, json_out])
|
| 173 |
-
replace_btn.click(
|
| 174 |
|
| 175 |
demo.launch()
|
|
|
|
| 134 |
|
| 135 |
##################################################################################
|
| 136 |
|
| 137 |
+
def random_text():
|
| 138 |
return random.choice(EXAMPLES)
|
| 139 |
|
| 140 |
def get_device_info():
|
|
|
|
| 158 |
label="Whisky Review (English only)",
|
| 159 |
lines=8,
|
| 160 |
placeholder="Enter whisky review",
|
| 161 |
+
value=random_text(),
|
| 162 |
)
|
| 163 |
with gr.Row():
|
| 164 |
replace_btn = gr.Button("Load Example", variant="secondary", scale=1)
|
|
|
|
| 170 |
|
| 171 |
# Events
|
| 172 |
submit_btn.click(predict, inputs=review_box, outputs=[html_out, json_out])
|
| 173 |
+
replace_btn.click(random_text, outputs=review_box)
|
| 174 |
|
| 175 |
demo.launch()
|