Spaces:
Runtime error
Runtime error
Commit ·
d2ff475
1
Parent(s): 3e70386
Hide API key; hide test mode; add logo
Browse files
app.py
CHANGED
|
@@ -172,13 +172,14 @@ block = gr.Blocks(css="""
|
|
| 172 |
}
|
| 173 |
""")
|
| 174 |
with block:
|
| 175 |
-
api_key = gr.Textbox(
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
)
|
| 181 |
-
gr.
|
|
|
|
| 182 |
content = gr.Textbox(
|
| 183 |
label="Paragraph"
|
| 184 |
)
|
|
@@ -240,20 +241,20 @@ with block:
|
|
| 240 |
output_body = gr.Textbox(
|
| 241 |
label="Output"
|
| 242 |
)
|
| 243 |
-
with gr.Tab("Custom prompt"):
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
|
| 258 |
changes = gr.State()
|
| 259 |
edited = gr.State()
|
|
@@ -262,7 +263,7 @@ with block:
|
|
| 262 |
chain_intro = gr.State()
|
| 263 |
chain_body1 = gr.State()
|
| 264 |
|
| 265 |
-
api_key.change(load_chain, [api_key], [chain, llm, chain_intro, chain_body1])
|
| 266 |
|
| 267 |
inputs = [content, chain]
|
| 268 |
outputs = [output_before, output_after, changes, edited]
|
|
@@ -279,6 +280,8 @@ with block:
|
|
| 279 |
|
| 280 |
submit_intro.click(run, [content, chain_intro], output_intro)
|
| 281 |
submit_body.click(run_body, [content, chain_body1, llm], output_body) # body part A only
|
| 282 |
-
submit_custom.click(run_custom, [content, llm, prompt], output_custom)
|
|
|
|
|
|
|
| 283 |
|
| 284 |
block.launch(debug=True)
|
|
|
|
| 172 |
}
|
| 173 |
""")
|
| 174 |
with block:
|
| 175 |
+
# api_key = gr.Textbox(
|
| 176 |
+
# placeholder="Paste your OpenAPI API key here (sk-...)",
|
| 177 |
+
# show_label=False,
|
| 178 |
+
# lines=1,
|
| 179 |
+
# type="password"
|
| 180 |
+
# )
|
| 181 |
+
gr.HTML("""<div style="display: flex; justify-content: center; align-items: center"><a href="https://thinkcol.com/"><img src="https://thinkcol.com/thinkcol-logo.png" alt="ThinkCol" /></a></div>""")
|
| 182 |
+
gr.Markdown("""Paste a paragraph below, and then choose one of the modes to generate feedback.""")
|
| 183 |
content = gr.Textbox(
|
| 184 |
label="Paragraph"
|
| 185 |
)
|
|
|
|
| 241 |
output_body = gr.Textbox(
|
| 242 |
label="Output"
|
| 243 |
)
|
| 244 |
+
# with gr.Tab("Custom prompt"):
|
| 245 |
+
# gr.Markdown("This mode is for testing and debugging.")
|
| 246 |
+
# prompt = gr.Textbox(
|
| 247 |
+
# label="Prompt",
|
| 248 |
+
# value=GRAMMAR_PROMPT,
|
| 249 |
+
# lines=2
|
| 250 |
+
# )
|
| 251 |
+
# submit_custom = gr.Button(
|
| 252 |
+
# value="Run"
|
| 253 |
+
# ).style(full_width=False)
|
| 254 |
+
|
| 255 |
+
# output_custom = gr.Textbox(
|
| 256 |
+
# label="Output"
|
| 257 |
+
# )
|
| 258 |
|
| 259 |
changes = gr.State()
|
| 260 |
edited = gr.State()
|
|
|
|
| 263 |
chain_intro = gr.State()
|
| 264 |
chain_body1 = gr.State()
|
| 265 |
|
| 266 |
+
# api_key.change(load_chain, [api_key], [chain, llm, chain_intro, chain_body1])
|
| 267 |
|
| 268 |
inputs = [content, chain]
|
| 269 |
outputs = [output_before, output_after, changes, edited]
|
|
|
|
| 280 |
|
| 281 |
submit_intro.click(run, [content, chain_intro], output_intro)
|
| 282 |
submit_body.click(run_body, [content, chain_body1, llm], output_body) # body part A only
|
| 283 |
+
# submit_custom.click(run_custom, [content, llm, prompt], output_custom)
|
| 284 |
+
|
| 285 |
+
block.load(load_chain, gr.State(""), [chain, llm, chain_intro, chain_body1])
|
| 286 |
|
| 287 |
block.launch(debug=True)
|