Skip to content

Commit

Permalink
[config] Add support for uploading sharding config file in chatbot (#…
Browse files Browse the repository at this point in the history
…1689)

Signed-off-by: Gaurav Shukla <gaurav@nod-labs.com>
  • Loading branch information
Shukla-Gaurav authored Jul 24, 2023
1 parent f3cb63f commit 5497af1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apps/stable_diffusion/web/ui/stablelm_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ def llm_chat_api(InputData: dict):
}


def view_json_file(file_obj):
content = ""
with open(file_obj.name, "r") as fopen:
content = fopen.read()
return content


with gr.Blocks(title="Chatbot") as stablelm_chat:
with gr.Row():
model_choices = list(
Expand Down Expand Up @@ -319,6 +326,14 @@ def llm_chat_api(InputData: dict):
],
visible=True,
)
with gr.Row():
with gr.Group():
config_file = gr.File(label="Upload sharding configuration")
json_view_button = gr.Button("View as JSON")
json_view = gr.JSON()
json_view_button.click(
fn=view_json_file, inputs=[config_file], outputs=[json_view]
)
chatbot = gr.Chatbot(height=500)
with gr.Row():
with gr.Column():
Expand Down

0 comments on commit 5497af1

Please sign in to comment.