Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -394,54 +394,32 @@ def respond(
|
|
394 |
def set_suggested_question(question, textbox):
|
395 |
textbox.value = question
|
396 |
|
397 |
-
|
398 |
"""
|
399 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
400 |
"""
|
401 |
-
demo = gr.ChatInterface(
|
402 |
-
respond,
|
403 |
-
additional_inputs=[
|
404 |
-
gr.Textbox(value=airavath_details, label="System message"),
|
405 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
406 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
407 |
-
gr.Slider(
|
408 |
-
minimum=0.1,
|
409 |
-
maximum=1.0,
|
410 |
-
value=0.95,
|
411 |
-
step=0.05,
|
412 |
-
label="Top-p (nucleus sampling)",
|
413 |
-
),
|
414 |
-
],
|
415 |
-
)
|
416 |
-
|
417 |
-
|
418 |
-
# Create an interface for suggested questions
|
419 |
-
suggested_questions_dropdown = gr.Dropdown(
|
420 |
-
choices=suggested_questions,
|
421 |
-
label="Suggested Questions",
|
422 |
-
interactive=True,
|
423 |
-
)
|
424 |
-
|
425 |
-
# Textbox for user to input their message
|
426 |
-
user_input = gr.Textbox(label="Your question here")
|
427 |
-
|
428 |
-
# Button to set the selected suggested question to the user input textbox
|
429 |
-
set_question_button = gr.Button("Set Suggested Question")
|
430 |
-
|
431 |
-
# Function to update the user input textbox with the selected suggested question
|
432 |
-
set_question_button.click(
|
433 |
-
set_suggested_question,
|
434 |
-
inputs=[suggested_questions_dropdown, user_input],
|
435 |
-
outputs=[user_input],
|
436 |
-
)
|
437 |
|
438 |
demo = gr.Blocks()
|
439 |
|
440 |
with demo:
|
441 |
gr.Markdown("# Airavath Technologies Chatbot")
|
442 |
-
|
443 |
-
|
444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
gr.ChatInterface(
|
446 |
respond,
|
447 |
additional_inputs=[
|
@@ -456,7 +434,7 @@ with demo:
|
|
456 |
label="Top-p (nucleus sampling)",
|
457 |
),
|
458 |
],
|
459 |
-
)
|
460 |
|
461 |
if __name__ == "__main__":
|
462 |
demo.launch()
|
|
|
394 |
def set_suggested_question(question, textbox):
|
395 |
textbox.value = question
|
396 |
|
|
|
397 |
"""
|
398 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
399 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
|
401 |
demo = gr.Blocks()
|
402 |
|
403 |
with demo:
|
404 |
gr.Markdown("# Airavath Technologies Chatbot")
|
405 |
+
|
406 |
+
with gr.Row():
|
407 |
+
suggested_questions_dropdown = gr.Dropdown(
|
408 |
+
choices=suggested_questions,
|
409 |
+
label="Suggested Questions",
|
410 |
+
interactive=True,
|
411 |
+
)
|
412 |
+
|
413 |
+
user_input = gr.Textbox(label="Your question here")
|
414 |
+
|
415 |
+
set_question_button = gr.Button("Set Suggested Question")
|
416 |
+
|
417 |
+
set_question_button.click(
|
418 |
+
set_suggested_question,
|
419 |
+
inputs=[suggested_questions_dropdown, user_input],
|
420 |
+
outputs=[user_input],
|
421 |
+
)
|
422 |
+
|
423 |
gr.ChatInterface(
|
424 |
respond,
|
425 |
additional_inputs=[
|
|
|
434 |
label="Top-p (nucleus sampling)",
|
435 |
),
|
436 |
],
|
437 |
+
)
|
438 |
|
439 |
if __name__ == "__main__":
|
440 |
demo.launch()
|