Spaces:
Sleeping
Sleeping
File size: 1,355 Bytes
030be06 a390966 030be06 a390966 030be06 a390966 030be06 a390966 030be06 a390966 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | from src.config.settings import MODEL_NAME, MODEL_ID, MODEL_TEMPERATURE, MODEL_OPTIONS
from src.utils import update_chatbot
import gradio as gr
# Gradio Interface using Chatbot and conditional web search
with gr.Blocks(theme=gr.themes.Soft(primary_hue="emerald", secondary_hue="sky")) as app:
gr.Markdown(f"# {MODEL_NAME}")
with gr.Row():
chatbot = gr.Chatbot(label="Chatbot Responses")
with gr.Row():
question_input = gr.Textbox(lines=2, label="Ask a Question")
web_search_checkbox = gr.Checkbox(label="Enhance with Web Search", value=False)
with gr.Row():
model_input = gr.Dropdown(label="Model", value=MODEL_ID, choices=MODEL_OPTIONS)
temperature_slider = gr.Slider(
minimum=0.0,
maximum=2.0,
value=MODEL_TEMPERATURE,
step=0.1,
label="Temperature",
)
stream_checkbox = gr.Checkbox(label="Stream response", value=True)
with gr.Row():
submit_button = gr.Button("Submit")
submit_button.click(
fn=update_chatbot,
inputs=[
question_input,
web_search_checkbox,
chatbot,
model_input,
temperature_slider,
stream_checkbox,
],
outputs=[chatbot],
)
if __name__ == "__main__":
app.launch(share=True)
|