Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -45,8 +45,6 @@ rag_chain = (
|
|
45 |
| llm
|
46 |
| StrOutputParser()
|
47 |
)
|
48 |
-
|
49 |
-
|
50 |
import gradio as gr
|
51 |
|
52 |
# Function to handle prompt and query the RAG chain
|
@@ -78,32 +76,44 @@ if __name__ == "__main__":
|
|
78 |
|
79 |
# Use Blocks API for layout customization
|
80 |
with gr.Blocks() as demo:
|
81 |
-
gr.
|
82 |
-
|
83 |
-
|
84 |
-
with gr.Row(elem_id="chat-container"):
|
85 |
-
chatbot = gr.Chatbot([{"role": "Medical Expert", "content": greetingsmessage}],
|
86 |
-
type="messages",
|
87 |
-
avatar_images=["./avatar.png", "./avatar.png"])
|
88 |
-
|
89 |
-
gr.Textbox(label="Ask a question:", placeholder="Type your question here...",
|
90 |
-
interactive=True, elem_id="input-box").submit(handle_prompt, chatbot)
|
91 |
-
|
92 |
-
# Apply custom CSS for dimensions
|
93 |
-
demo.launch(css="""
|
94 |
#chat-container {
|
95 |
width: 800px;
|
96 |
height: 500px;
|
97 |
margin: auto;
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
#title {
|
100 |
text-align: center;
|
|
|
|
|
101 |
}
|
102 |
#description {
|
103 |
margin: 20px auto;
|
104 |
max-width: 700px;
|
|
|
105 |
}
|
106 |
#input-box {
|
107 |
width: 100%;
|
|
|
108 |
}
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
| llm
|
46 |
| StrOutputParser()
|
47 |
)
|
|
|
|
|
48 |
import gradio as gr
|
49 |
|
50 |
# Function to handle prompt and query the RAG chain
|
|
|
76 |
|
77 |
# Use Blocks API for layout customization
|
78 |
with gr.Blocks() as demo:
|
79 |
+
gr.HTML("""
|
80 |
+
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
#chat-container {
|
82 |
width: 800px;
|
83 |
height: 500px;
|
84 |
margin: auto;
|
85 |
+
border: 1px solid #ccc;
|
86 |
+
padding: 10px;
|
87 |
+
border-radius: 10px;
|
88 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
89 |
}
|
90 |
#title {
|
91 |
text-align: center;
|
92 |
+
font-size: 24px;
|
93 |
+
font-weight: bold;
|
94 |
}
|
95 |
#description {
|
96 |
margin: 20px auto;
|
97 |
max-width: 700px;
|
98 |
+
font-size: 16px;
|
99 |
}
|
100 |
#input-box {
|
101 |
width: 100%;
|
102 |
+
margin-top: 10px;
|
103 |
}
|
104 |
+
</style>
|
105 |
+
""") # Include custom CSS
|
106 |
+
|
107 |
+
gr.Markdown("### MediGuide ChatBot", elem_id="title") # Title
|
108 |
+
gr.Markdown(description, elem_id="description") # Description
|
109 |
+
|
110 |
+
with gr.Row(elem_id="chat-container"):
|
111 |
+
chatbot = gr.Chatbot([{"role": "Medical Expert", "content": greetingsmessage}],
|
112 |
+
type="messages",
|
113 |
+
avatar_images=["./avatar.png", "./avatar.png"])
|
114 |
+
|
115 |
+
gr.Textbox(label="Ask a question:", placeholder="Type your question here...",
|
116 |
+
interactive=True, elem_id="input-box").submit(handle_prompt, chatbot)
|
117 |
+
|
118 |
+
demo.launch()
|
119 |
+
|