Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -70,19 +70,18 @@ train_data, test_data= train_test_split(df, test_size=0.15, random_state=42 )
|
|
70 |
howto= """Welcome to the <b>Medical Chatbot</b>, powered by Gradio.
|
71 |
Currently, the chatbot can WELCOME YOU, PREDICT DISEASE based on your symptoms and SUGGEST POSSIBLE SOLUTIONS AND RECOMENDATIONS, and BID YOU FAREWELL.
|
72 |
<b>How to Start:</b> Simply type your messages in the textbox to chat with the Chatbot and press enter!<br><br>
|
73 |
-
The bot will respond based on the best possible answers to your messages.
|
74 |
|
75 |
-
"""
|
76 |
# Create the gradio demo
|
77 |
with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;} #chatbot {height: 520px; overflow: auto;}""") as demo:
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
'''
|
86 |
def respond(message, chat_history):
|
87 |
# Create couple of if-else statements to capture/mimick peoples's Interaction
|
88 |
embedder = SentenceTransformer(args.embedder, device=device)
|
@@ -92,8 +91,8 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
|
|
92 |
chat_history.append((message, bot_message))
|
93 |
time.sleep(2)
|
94 |
return "", chat_history
|
95 |
-
'''
|
96 |
-
def respond(message, chat_history, base_model = "
|
97 |
# define the model and tokenizer.
|
98 |
# model = PhiForCausalLM.from_pretrained(base_model)
|
99 |
model = AutoModelForCausalLM.from_pretrained(base_model)
|
@@ -121,8 +120,9 @@ def respond(message, chat_history, base_model = "microsoft/phi-2", device=device
|
|
121 |
time.sleep(2)
|
122 |
return "", chat_history
|
123 |
#return bot_message
|
124 |
-
|
125 |
-
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
|
|
126 |
|
127 |
# Launch the demo
|
128 |
demo.launch()
|
|
|
70 |
howto= """Welcome to the <b>Medical Chatbot</b>, powered by Gradio.
|
71 |
Currently, the chatbot can WELCOME YOU, PREDICT DISEASE based on your symptoms and SUGGEST POSSIBLE SOLUTIONS AND RECOMENDATIONS, and BID YOU FAREWELL.
|
72 |
<b>How to Start:</b> Simply type your messages in the textbox to chat with the Chatbot and press enter!<br><br>
|
73 |
+
The bot will respond based on the best possible answers to your messages."""
|
74 |
|
|
|
75 |
# Create the gradio demo
|
76 |
with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;} #chatbot {height: 520px; overflow: auto;}""") as demo:
|
77 |
+
gr.HTML('<h1 align="center">Medical Chatbot: ARIN 7102')
|
78 |
+
#gr.HTML('<h3 align="center">To know more about this project')
|
79 |
+
with gr.Accordion("Follow these Steps to use the Gradio WebUI", open=True):
|
80 |
+
gr.HTML(howto)
|
81 |
+
chatbot = gr.Chatbot()
|
82 |
+
msg = gr.Textbox()
|
83 |
+
clear = gr.ClearButton([msg, chatbot])
|
84 |
+
'''
|
85 |
def respond(message, chat_history):
|
86 |
# Create couple of if-else statements to capture/mimick peoples's Interaction
|
87 |
embedder = SentenceTransformer(args.embedder, device=device)
|
|
|
91 |
chat_history.append((message, bot_message))
|
92 |
time.sleep(2)
|
93 |
return "", chat_history
|
94 |
+
'''
|
95 |
+
def respond(message, chat_history, base_model = "/home/henry/Desktop/ARIN7102/phi-2", device=device): # "meta-llama/Meta-Llama-3-70B"
|
96 |
# define the model and tokenizer.
|
97 |
# model = PhiForCausalLM.from_pretrained(base_model)
|
98 |
model = AutoModelForCausalLM.from_pretrained(base_model)
|
|
|
120 |
time.sleep(2)
|
121 |
return "", chat_history
|
122 |
#return bot_message
|
123 |
+
|
124 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
125 |
+
|
126 |
|
127 |
# Launch the demo
|
128 |
demo.launch()
|