Skip to content

Instantly share code, notes, and snippets.

@sunilkumardash9
Last active April 28, 2023 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunilkumardash9/508cdfd00d95108e6db6db7806505493 to your computer and use it in GitHub Desktop.
Save sunilkumardash9/508cdfd00d95108e6db6db7806505493 to your computer and use it in GitHub Desktop.
with gr.Blocks() as demo:
radio = gr.Radio(value='gpt-3.5-turbo', choices=['gpt-3.5-turbo','gpt-4'], label='models')
chatbot = gr.Chatbot(value=[], elem_id="chatbot").style(height=650)
with gr.Row():
with gr.Column(scale=0.90):
txt = gr.Textbox(
show_label=False,
placeholder="Enter text and press enter",
).style(container=False)
with gr.Column(scale=0.10):
cost_view = gr.Textbox(label='usage in $',value=0)
txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
generate_response, inputs =[chatbot,],outputs = chatbot,).then(
calc_cost, outputs=cost_view)
demo.queue()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment