Parishri07 commited on
Commit
a77f041
·
verified ·
1 Parent(s): 376bb5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -13
app.py CHANGED
@@ -1,13 +1,23 @@
1
- import streamlit as st
2
- from chatbot.chatbot import chatbot_response
3
-
4
- st.title("Clinical Readmission Assistant")
5
-
6
- note = st.text_area("Paste Discharge Summary")
7
- risk_score = st.slider("Predicted Readmission Risk", 0.0, 1.0, 0.65)
8
-
9
- question = st.text_input("Ask a question")
10
-
11
- if st.button("Ask"):
12
- answer = chatbot_response(question, note, risk_score)
13
- st.write(answer)
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from chatbot.chatbot import chatbot_response
3
+
4
+ def respond(discharge_summary, risk_score, question):
5
+ return chatbot_response(
6
+ question=question,
7
+ note=discharge_summary,
8
+ risk_score=float(risk_score)
9
+ )
10
+
11
+ demo = gr.Interface(
12
+ fn=respond,
13
+ inputs=[
14
+ gr.Textbox(label="Discharge Summary", lines=12),
15
+ gr.Slider(0, 1, value=0.65, label="Predicted Readmission Risk"),
16
+ gr.Textbox(label="Ask a question")
17
+ ],
18
+ outputs=gr.Textbox(label="Assistant Response"),
19
+ title="Clinical Readmission Assistant",
20
+ description="Decision-support chatbot for explaining readmission risk"
21
+ )
22
+
23
+ demo.launch(server_name="0.0.0.0", server_port=7860)