Tafazzul-Nadeeem commited on
Commit
1dbf96e
·
1 Parent(s): 5d7f3e1
Files changed (3) hide show
  1. .DS_Store +0 -0
  2. last_stable_app.py +14 -6
  3. medScan_rate_offers.md +0 -93
.DS_Store ADDED
Binary file (6.15 kB). View file
 
last_stable_app.py CHANGED
@@ -1,10 +1,11 @@
1
  import gradio as gr
2
  from openai import OpenAI
3
- from dotenv import load_dotenv
4
  import os
5
  import base64
6
  import time
7
  import copy
 
 
8
  # Load environment variables from .env file
9
  load_dotenv()
10
 
@@ -22,6 +23,13 @@ with gr.Blocks() as demo:
22
  )
23
  clear = gr.ClearButton([chat_input, chatbot])
24
 
 
 
 
 
 
 
 
25
  def encode_image(image_path):
26
  with open(image_path, "rb") as f:
27
  return base64.b64encode(f.read()).decode("utf-8")
@@ -37,7 +45,7 @@ with gr.Blocks() as demo:
37
  # return "", history + [{"role": "user", "content": user_message}]
38
 
39
  def respond(history):
40
- print("history", history)
41
  if len(history) == 1:
42
  history.insert(0,{"role": "system", "content": "You are a helpful assistant."})
43
  # print("history after insert", history)
@@ -50,10 +58,10 @@ with gr.Blocks() as demo:
50
  "text": msg["content"]
51
  }]
52
  if isinstance(msg["content"],tuple):
53
- print("inside tuple", msg["content"])
54
  # If the content is a file path, encode it
55
  file_path = msg["content"][0]
56
- print("file_path", file_path)
57
  encoded_content = encode_image(file_path)
58
  messages[i]["content"] = [{
59
  "type": "image_url",
@@ -65,7 +73,7 @@ with gr.Blocks() as demo:
65
  "content": msg["content"]
66
  }
67
  clean_messages.append(clean_msg)
68
- print("First messages", messages[0])
69
  response = client.chat.completions.create(
70
  model="gpt-4o-mini",
71
  messages=clean_messages,
@@ -77,7 +85,7 @@ with gr.Blocks() as demo:
77
  history.append({"role": "assistant", "content": ""})
78
 
79
  # return history
80
- print("history", history)
81
  for character in response:
82
  history[-1]['content'] += character
83
  time.sleep(0.005)
 
1
  import gradio as gr
2
  from openai import OpenAI
 
3
  import os
4
  import base64
5
  import time
6
  import copy
7
+ from rag import get_top_k
8
+ from dotenv import load_dotenv
9
  # Load environment variables from .env file
10
  load_dotenv()
11
 
 
23
  )
24
  clear = gr.ClearButton([chat_input, chatbot])
25
 
26
+ def use_rag(query, k=3):
27
+ """
28
+ Use RAG to get top k results for the query.
29
+ """
30
+ results = get_top_k(query, k=k)
31
+ return results
32
+
33
  def encode_image(image_path):
34
  with open(image_path, "rb") as f:
35
  return base64.b64encode(f.read()).decode("utf-8")
 
45
  # return "", history + [{"role": "user", "content": user_message}]
46
 
47
  def respond(history):
48
+ # print("history", history)
49
  if len(history) == 1:
50
  history.insert(0,{"role": "system", "content": "You are a helpful assistant."})
51
  # print("history after insert", history)
 
58
  "text": msg["content"]
59
  }]
60
  if isinstance(msg["content"],tuple):
61
+ # print("inside tuple", msg["content"])
62
  # If the content is a file path, encode it
63
  file_path = msg["content"][0]
64
+ # print("file_path", file_path)
65
  encoded_content = encode_image(file_path)
66
  messages[i]["content"] = [{
67
  "type": "image_url",
 
73
  "content": msg["content"]
74
  }
75
  clean_messages.append(clean_msg)
76
+ # print("First messages", messages[0])
77
  response = client.chat.completions.create(
78
  model="gpt-4o-mini",
79
  messages=clean_messages,
 
85
  history.append({"role": "assistant", "content": ""})
86
 
87
  # return history
88
+ # print("history", history)
89
  for character in response:
90
  history[-1]['content'] += character
91
  time.sleep(0.005)
medScan_rate_offers.md DELETED
@@ -1,93 +0,0 @@
1
- # 📋 Scan Diagnostic Lab - Rate List
2
- *(Valid from July 2025 to September 2025)*
3
-
4
- Welcome to **Scan Diagnostic Lab**. We are committed to providing accurate diagnostics with transparent pricing.
5
-
6
- ---
7
-
8
- ## 🩺 Radiology Scans
9
-
10
- **MRI Brain**
11
- Price: ₹6,500
12
-
13
- **MRI Spine**
14
- Price: ₹7,500
15
-
16
- **CT Chest**
17
- Price: ₹4,200
18
-
19
- **CT Abdomen**
20
- Price: ₹4,500
21
-
22
- **Ultrasound Whole Abdomen**
23
- Price: ₹1,500
24
-
25
- **3D/4D Pregnancy Ultrasound**
26
- Price: ₹2,200
27
-
28
- **Digital X-Ray (Single View)**
29
- Price: ₹500
30
-
31
- ---
32
-
33
- ## 🧪 Laboratory Tests
34
-
35
- **Complete Blood Count (CBC)**
36
- Price: ₹350
37
-
38
- **Thyroid Profile (T3, T4, TSH)**
39
- Price: ₹700
40
-
41
- **Vitamin D Test**
42
- Price: ₹1,200
43
-
44
- **HbA1c (Glycated Hemoglobin)**
45
- Price: ₹450
46
-
47
- **Liver Function Test (LFT)**
48
- Price: ₹850
49
-
50
- **Kidney Function Test (KFT)**
51
- Price: ₹850
52
-
53
- ---
54
-
55
- ## 💖 Health Packages
56
-
57
- **Basic Health Checkup**
58
- Price: ₹1,999
59
-
60
- **Comprehensive Health Checkup**
61
- Price: ₹4,999
62
-
63
- **Women Wellness Package**
64
- Price: ₹3,200
65
-
66
- **Senior Citizen Preventive Checkup**
67
- Price: ₹3,000
68
-
69
- **Diabetic Care Package**
70
- Price: ₹2,500
71
-
72
- ---
73
-
74
- ## 🎁 Special Offers and Discounts
75
-
76
- ✅ **Early Bird Discount:** Book any scan slot before 9 AM and get 10% off.
77
- ✅ **Senior Citizen Discount:** 15% off on MRI and CT scans for patients above 60 years.
78
- ✅ **Women Special:** 10% off on Ultrasound Whole Abdomen and 20% off on Vitamin D Test every Wednesday.
79
- ✅ **Festival Offer:** During Raksha Bandhan, get an additional 5% off on all health packages.
80
- ✅ **Family Discount:** 15% off on Comprehensive Health Checkup when booked for 2 or more family members.
81
- ✅ **Referral Offer:** Refer a friend and receive a ₹250 lab test voucher.
82
- ✅ **Combo Offer:** ₹500 off when you book CT Abdomen along with Ultrasound Abdomen.
83
- ✅ **Doctor Referral:** 15% off on 3D/4D Pregnancy Ultrasound with a valid doctor prescription.
84
- ✅ **Online Booking:** 10% off on Thyroid Profile when booked through our website.
85
-
86
- ---
87
-
88
- *Note: All prices are inclusive of GST. Offers valid for a limited period only. Please carry valid ID proof to avail discounts.*
89
-
90
- 📞 **Helpline:** 1800-123-456
91
- 🌐 **Website:** [www.scandiagnosticlab.in](http://www.scandiagnosticlab.in)
92
-
93
- ---