Update app.py
Browse files
app.py
CHANGED
|
@@ -149,11 +149,13 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
| 149 |
|
| 150 |
try:
|
| 151 |
# 중간 상태 표시
|
| 152 |
-
yield
|
| 153 |
-
"
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
|
|
|
|
|
|
| 157 |
|
| 158 |
response = client.messages.create(
|
| 159 |
model="claude-3-sonnet-20240229",
|
|
@@ -171,13 +173,13 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
| 171 |
}])
|
| 172 |
|
| 173 |
# 최종 결과 반환
|
| 174 |
-
yield
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
|
| 182 |
except Exception as e:
|
| 183 |
raise ValueError(f'Error calling Claude API: {str(e)}')
|
|
@@ -185,13 +187,7 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
| 185 |
btn.click(
|
| 186 |
generation_code,
|
| 187 |
inputs=[input, setting, history],
|
| 188 |
-
outputs=
|
| 189 |
-
"code_output": code_output,
|
| 190 |
-
"history": history,
|
| 191 |
-
"sandbox": sandbox,
|
| 192 |
-
"state_tab": state_tab,
|
| 193 |
-
"code_drawer": code_drawer
|
| 194 |
-
}
|
| 195 |
)
|
| 196 |
|
| 197 |
clear_btn.click(clear_history, inputs=[], outputs=[history])
|
|
|
|
| 149 |
|
| 150 |
try:
|
| 151 |
# 중간 상태 표시
|
| 152 |
+
yield [
|
| 153 |
+
"Generating code...", # code_output
|
| 154 |
+
_history, # history
|
| 155 |
+
None, # sandbox
|
| 156 |
+
gr.update(active_key="loading"), # state_tab
|
| 157 |
+
gr.update(open=True) # code_drawer
|
| 158 |
+
]
|
| 159 |
|
| 160 |
response = client.messages.create(
|
| 161 |
model="claude-3-sonnet-20240229",
|
|
|
|
| 173 |
}])
|
| 174 |
|
| 175 |
# 최종 결과 반환
|
| 176 |
+
yield [
|
| 177 |
+
content, # code_output
|
| 178 |
+
_history, # history
|
| 179 |
+
send_to_sandbox(remove_code_block(content)), # sandbox
|
| 180 |
+
gr.update(active_key="render"), # state_tab
|
| 181 |
+
gr.update(open=True) # code_drawer
|
| 182 |
+
]
|
| 183 |
|
| 184 |
except Exception as e:
|
| 185 |
raise ValueError(f'Error calling Claude API: {str(e)}')
|
|
|
|
| 187 |
btn.click(
|
| 188 |
generation_code,
|
| 189 |
inputs=[input, setting, history],
|
| 190 |
+
outputs=[code_output, history, sandbox, state_tab, code_drawer]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
)
|
| 192 |
|
| 193 |
clear_btn.click(clear_history, inputs=[], outputs=[history])
|