Spaces:
Sleeping
Sleeping
error hadling: then() => success()
Browse files
app.py
CHANGED
|
@@ -27,19 +27,19 @@ def init():
|
|
| 27 |
|
| 28 |
## Config Functions
|
| 29 |
|
| 30 |
-
def set_same_cheap_strong(set_same:bool, cheap_base, cheap_key
|
| 31 |
-
setup_zone = gr.Accordion("AI setup (OpenAI-compatible LLM API)", open=True)
|
| 32 |
if set_same:
|
| 33 |
return (gr.Textbox(value=cheap_base, label="API Base", interactive=False),
|
| 34 |
gr.Textbox(value=cheap_key, label="API key", type="password", interactive=False),
|
| 35 |
gr.Textbox(value=cheap_model, label="Model ID", interactive=False),
|
| 36 |
-
setup_zone,
|
| 37 |
)
|
| 38 |
else:
|
| 39 |
return (gr.Textbox(value=cheap_base, label="API Base", interactive=True),
|
| 40 |
gr.Textbox(value=cheap_key, label="API key", type="password", interactive=True),
|
| 41 |
gr.Textbox(value=cheap_model, label="Model ID", interactive=True),
|
| 42 |
-
setup_zone,
|
| 43 |
)
|
| 44 |
|
| 45 |
|
|
@@ -182,21 +182,24 @@ with gr.Blocks(
|
|
| 182 |
|
| 183 |
is_same_cheap_strong.change(fn= set_same_cheap_strong,
|
| 184 |
inputs=[is_same_cheap_strong, cheap_base, cheap_key, cheap_model],
|
| 185 |
-
outputs=[strong_base, strong_key, strong_model
|
| 186 |
|
| 187 |
-
infer_btn.click(
|
|
|
|
|
|
|
|
|
|
| 188 |
fn=prepare_input,
|
| 189 |
inputs=[jd_info, cv_file, cv_text],
|
| 190 |
outputs=[jd_info, cv_text]
|
| 191 |
-
).
|
| 192 |
fn=run_refine,
|
| 193 |
inputs=[cheap_base, cheap_key, cheap_model, jd_info, cv_text],
|
| 194 |
outputs=[min_jd, min_cv],
|
| 195 |
-
).
|
| 196 |
-
).
|
| 197 |
-
).
|
| 198 |
-
).
|
| 199 |
-
).
|
| 200 |
|
| 201 |
|
| 202 |
if __name__ == "__main__":
|
|
|
|
| 27 |
|
| 28 |
## Config Functions
|
| 29 |
|
| 30 |
+
def set_same_cheap_strong(set_same:bool, cheap_base, cheap_key):
|
| 31 |
+
# setup_zone = gr.Accordion("AI setup (OpenAI-compatible LLM API)", open=True)
|
| 32 |
if set_same:
|
| 33 |
return (gr.Textbox(value=cheap_base, label="API Base", interactive=False),
|
| 34 |
gr.Textbox(value=cheap_key, label="API key", type="password", interactive=False),
|
| 35 |
gr.Textbox(value=cheap_model, label="Model ID", interactive=False),
|
| 36 |
+
# setup_zone,
|
| 37 |
)
|
| 38 |
else:
|
| 39 |
return (gr.Textbox(value=cheap_base, label="API Base", interactive=True),
|
| 40 |
gr.Textbox(value=cheap_key, label="API key", type="password", interactive=True),
|
| 41 |
gr.Textbox(value=cheap_model, label="Model ID", interactive=True),
|
| 42 |
+
# setup_zone,
|
| 43 |
)
|
| 44 |
|
| 45 |
|
|
|
|
| 182 |
|
| 183 |
is_same_cheap_strong.change(fn= set_same_cheap_strong,
|
| 184 |
inputs=[is_same_cheap_strong, cheap_base, cheap_key, cheap_model],
|
| 185 |
+
outputs=[strong_base, strong_key, strong_model])
|
| 186 |
|
| 187 |
+
infer_btn.click(fn= set_same_cheap_strong,
|
| 188 |
+
inputs=[is_same_cheap_strong, cheap_base, cheap_key, cheap_model],
|
| 189 |
+
outputs=[strong_base, strong_key, strong_model]
|
| 190 |
+
).success(
|
| 191 |
fn=prepare_input,
|
| 192 |
inputs=[jd_info, cv_file, cv_text],
|
| 193 |
outputs=[jd_info, cv_text]
|
| 194 |
+
).success(
|
| 195 |
fn=run_refine,
|
| 196 |
inputs=[cheap_base, cheap_key, cheap_model, jd_info, cv_text],
|
| 197 |
outputs=[min_jd, min_cv],
|
| 198 |
+
).success(fn=lambda:[gr.Accordion("Expert Zone", open=True),gr.Accordion("Reformatting", open=False)],inputs=None, outputs=[expert_zone, reformat_zone]
|
| 199 |
+
).success(fn=run_compose, inputs=[strong_base, strong_key, strong_model, min_jd, min_cv], outputs=[debug_CoT]
|
| 200 |
+
).success(fn=lambda:gr.Accordion("Expert Zone", open=False),inputs=None, outputs=[expert_zone]
|
| 201 |
+
).success(fn=finalize_letter_txt, inputs=[cheap_base, cheap_key, cheap_model, debug_CoT], outputs=[cover_letter_text]
|
| 202 |
+
).success(fn=finalize_letter_pdf, inputs=[cheap_base, cheap_key, cheap_model, jd_info, cv_text, cover_letter_text], outputs=[debug_jobapp, cover_letter_pdf])
|
| 203 |
|
| 204 |
|
| 205 |
if __name__ == "__main__":
|