Spaces:
Running on Zero
Running on Zero
Remove duplicate uploaded patent summary from UI
Browse files- app/ui_workflow.py +3 -5
app/ui_workflow.py
CHANGED
|
@@ -44,7 +44,6 @@ def build_app(process, unused_gpu_slot=None, infer_windows=None):
|
|
| 44 |
gr.Markdown('# Translate patents to SysML v2\nUpload a patent. Generate a system model.')
|
| 45 |
patent = gr.File(label='Patent HTML 路 whole patents', file_types=['.html', '.htm'],
|
| 46 |
type='filepath', elem_id='patent-upload')
|
| 47 |
-
uploaded = gr.Textbox(label='Uploaded patent', visible=False, interactive=False, elem_id='uploaded-patent')
|
| 48 |
with gr.Row(visible=False, elem_id='method-options') as methods:
|
| 49 |
agents = gr.Button('AI Agents', elem_id='method-agents')
|
| 50 |
nlp = gr.Button('Fine-Tuned NLP', elem_id='method-nlp')
|
|
@@ -126,14 +125,13 @@ def build_app(process, unused_gpu_slot=None, infer_windows=None):
|
|
| 126 |
def on_upload(file):
|
| 127 |
valid, message = False, ''
|
| 128 |
try:
|
| 129 |
-
|
| 130 |
-
valid
|
| 131 |
except (ValueError, OSError) as error:
|
| 132 |
if file:
|
| 133 |
message = str(error)
|
| 134 |
return {**render({}), selected: None, pending: None, methods: gr.update(visible=valid),
|
| 135 |
agents: gr.update(variant='secondary'), nlp: gr.update(variant='secondary'),
|
| 136 |
-
uploaded: gr.update(visible=valid, value=message if valid else ''),
|
| 137 |
disclosure: gr.update(visible=valid),
|
| 138 |
start: gr.update(visible=False, interactive=False), modal: gr.update(visible=False),
|
| 139 |
reconnect: gr.update(visible=False), status: gr.update(visible=bool(file) and not valid,
|
|
@@ -246,7 +244,7 @@ def build_app(process, unused_gpu_slot=None, infer_windows=None):
|
|
| 246 |
reconnect.click(reconnect_selected, [patent, session, selected], [modal, pending, login_status, connect], api_name=False, queue=False)
|
| 247 |
login_event = connect.click(sign_in, [patent, session, selected, pending, artifacts], [connect, login_status, modal, reconnect, start, status, *artifact_outputs, pending, patent, agents, nlp], api_name=False, concurrency_limit=4)
|
| 248 |
close.click(dismiss_login, outputs=[modal, connect, pending], cancels=[login_event], api_name=False, queue=False)
|
| 249 |
-
patent.change(on_upload, patent, [*artifact_outputs, selected, pending, methods, agents, nlp,
|
| 250 |
score_model.click(score_ui, [patent, artifacts, session], [*artifact_outputs, pending, modal, login_status, status, reconnect, start, patent, agents, nlp], api_name='score_model', api_visibility='undocumented', concurrency_limit=1, concurrency_id='patent_processing')
|
| 251 |
start.click(run_ui, [patent, selected, session], [*artifact_outputs, start, patent, agents, nlp, status, modal, reconnect], api_name='generate_model', api_visibility='undocumented', concurrency_limit=1, concurrency_id='patent_processing')
|
| 252 |
return app
|
|
|
|
| 44 |
gr.Markdown('# Translate patents to SysML v2\nUpload a patent. Generate a system model.')
|
| 45 |
patent = gr.File(label='Patent HTML 路 whole patents', file_types=['.html', '.htm'],
|
| 46 |
type='filepath', elem_id='patent-upload')
|
|
|
|
| 47 |
with gr.Row(visible=False, elem_id='method-options') as methods:
|
| 48 |
agents = gr.Button('AI Agents', elem_id='method-agents')
|
| 49 |
nlp = gr.Button('Fine-Tuned NLP', elem_id='method-nlp')
|
|
|
|
| 125 |
def on_upload(file):
|
| 126 |
valid, message = False, ''
|
| 127 |
try:
|
| 128 |
+
validate_patent(file)
|
| 129 |
+
valid = True
|
| 130 |
except (ValueError, OSError) as error:
|
| 131 |
if file:
|
| 132 |
message = str(error)
|
| 133 |
return {**render({}), selected: None, pending: None, methods: gr.update(visible=valid),
|
| 134 |
agents: gr.update(variant='secondary'), nlp: gr.update(variant='secondary'),
|
|
|
|
| 135 |
disclosure: gr.update(visible=valid),
|
| 136 |
start: gr.update(visible=False, interactive=False), modal: gr.update(visible=False),
|
| 137 |
reconnect: gr.update(visible=False), status: gr.update(visible=bool(file) and not valid,
|
|
|
|
| 244 |
reconnect.click(reconnect_selected, [patent, session, selected], [modal, pending, login_status, connect], api_name=False, queue=False)
|
| 245 |
login_event = connect.click(sign_in, [patent, session, selected, pending, artifacts], [connect, login_status, modal, reconnect, start, status, *artifact_outputs, pending, patent, agents, nlp], api_name=False, concurrency_limit=4)
|
| 246 |
close.click(dismiss_login, outputs=[modal, connect, pending], cancels=[login_event], api_name=False, queue=False)
|
| 247 |
+
patent.change(on_upload, patent, [*artifact_outputs, selected, pending, methods, agents, nlp, disclosure, start, modal, reconnect, status], cancels=[login_event], api_name=False, queue=False)
|
| 248 |
score_model.click(score_ui, [patent, artifacts, session], [*artifact_outputs, pending, modal, login_status, status, reconnect, start, patent, agents, nlp], api_name='score_model', api_visibility='undocumented', concurrency_limit=1, concurrency_id='patent_processing')
|
| 249 |
start.click(run_ui, [patent, selected, session], [*artifact_outputs, start, patent, agents, nlp, status, modal, reconnect], api_name='generate_model', api_visibility='undocumented', concurrency_limit=1, concurrency_id='patent_processing')
|
| 250 |
return app
|