[config] Add support for uploading sharding config file in chatbot (#1689)

Signed-off-by: Gaurav Shukla <gaurav@nod-labs.com>
This commit is contained in:
Gaurav Shukla
2023-07-24 22:48:03 +05:30
committed by GitHub
parent f3cb63fc9c
commit 5497af1f56

View File

@@ -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(
@@ -319,6 +326,14 @@ with gr.Blocks(title="Chatbot") as stablelm_chat:
],
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():