Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -123,6 +123,26 @@ def easyphoto_infer(model_id, selected_template_images, additional_prompt, seed,
|
|
123 |
model_id = str(model_id).strip()
|
124 |
print('model id: ' + model_id)
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
for image_url in image_urls:
|
127 |
try:
|
128 |
params = {
|
@@ -161,6 +181,7 @@ def easyphoto_infer(model_id, selected_template_images, additional_prompt, seed,
|
|
161 |
|
162 |
with gr.Blocks() as easyphoto_demo:
|
163 |
model_id = gr.Textbox(visible=False)
|
|
|
164 |
with gr.TabItem('Training'):
|
165 |
with gr.Blocks():
|
166 |
with gr.Row():
|
@@ -184,7 +205,6 @@ with gr.Blocks() as easyphoto_demo:
|
|
184 |
'''
|
185 |
)
|
186 |
|
187 |
-
job_id = gr.Textbox(visible=False)
|
188 |
with gr.Row():
|
189 |
run_button = gr.Button('Submit My Training Job')
|
190 |
check_button = gr.Button('Check My Training Job Status')
|
|
|
123 |
model_id = str(model_id).strip()
|
124 |
print('model id: ' + model_id)
|
125 |
|
126 |
+
if job_id is None:
|
127 |
+
output_info = 'Status: no job id provided, please do model training first!'
|
128 |
+
return output_info, []
|
129 |
+
|
130 |
+
job_id = str(job_id).strip()
|
131 |
+
print('job id: ' + job_id)
|
132 |
+
|
133 |
+
check_client = ApiClient(host, appId, token)
|
134 |
+
check_api = AiServiceJobApi(check_client)
|
135 |
+
try:
|
136 |
+
job_id = int(str(job_id).strip())
|
137 |
+
response = check_api.get_async_job_with_id(job_id)
|
138 |
+
message = response.data['job']['message']
|
139 |
+
if not message == 'success':
|
140 |
+
output = 'Status: model training incomplete!'
|
141 |
+
return output, []
|
142 |
+
except:
|
143 |
+
output = 'Status: checking training status failed, please do model training first!'
|
144 |
+
return output, []
|
145 |
+
|
146 |
for image_url in image_urls:
|
147 |
try:
|
148 |
params = {
|
|
|
181 |
|
182 |
with gr.Blocks() as easyphoto_demo:
|
183 |
model_id = gr.Textbox(visible=False)
|
184 |
+
job_id = gr.Textbox(visible=False)
|
185 |
with gr.TabItem('Training'):
|
186 |
with gr.Blocks():
|
187 |
with gr.Row():
|
|
|
205 |
'''
|
206 |
)
|
207 |
|
|
|
208 |
with gr.Row():
|
209 |
run_button = gr.Button('Submit My Training Job')
|
210 |
check_button = gr.Button('Check My Training Job Status')
|