eudoxie commited on
Commit
e2faa8d
·
verified ·
1 Parent(s): c4fff82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -49,15 +49,33 @@ rag_chain = (
49
  import gradio as gr
50
 
51
  def rag_memory_stream(message, history):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  partial_text = ""
53
  for new_text in rag_chain.stream(message):
54
  partial_text += new_text
55
  yield partial_text
56
 
 
57
  examples = [
58
- "What are the Side effects of Doxycycline",
59
  "Can Doxycycline Treat Acnes",
60
- "Which Classification is Doxycycline"
61
  ]
62
 
63
  description = "Hello! Welcome to MediGuide ChatBot,AI-powered assistant designed to facilitate healthcare providers to make informed decision-making by providing reliable information about various medical drugs, including their uses, side effects, contraindications and classification"
 
49
  import gradio as gr
50
 
51
  def rag_memory_stream(message, history):
52
+ # Define possible greeting messages and their responses
53
+ greetings = {
54
+ "hello": "Hello! How can I assist you today?",
55
+ "hi": "Hi there! How can I help you?",
56
+ "good morning": "Good morning! How can I assist you?",
57
+ "good afternoon": "Good afternoon! What can I help you with?",
58
+ "good evening": "Good evening! Do you have any questions for me?",
59
+ }
60
+
61
+ # Normalize the input message to lowercase for comparison
62
+ normalized_message = message.strip().lower()
63
+
64
+ # Check if the message is a greeting
65
+ if normalized_message in greetings:
66
+ yield greetings[normalized_message]
67
+ return # End early as the greeting is handled
68
+
69
+ # Default behavior for non-greeting messages
70
  partial_text = ""
71
  for new_text in rag_chain.stream(message):
72
  partial_text += new_text
73
  yield partial_text
74
 
75
+
76
  examples = [
77
+ "What is Aspirin",
78
  "Can Doxycycline Treat Acnes",
 
79
  ]
80
 
81
  description = "Hello! Welcome to MediGuide ChatBot,AI-powered assistant designed to facilitate healthcare providers to make informed decision-making by providing reliable information about various medical drugs, including their uses, side effects, contraindications and classification"