Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,15 +6,15 @@ import timm
|
|
6 |
import torch
|
7 |
import pandas as pd
|
8 |
|
9 |
-
# Load pre-trained zero-shot model for text classification
|
10 |
-
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
11 |
|
12 |
-
# Pre-trained ResNet50 model for X-ray or image analysis
|
13 |
image_model = timm.create_model('resnet50', pretrained=True)
|
14 |
image_model.eval()
|
15 |
|
16 |
# Load saved TensorFlow eye disease detection model (TensorFlow Model without Keras)
|
17 |
-
eye_model = tf.
|
18 |
|
19 |
# Patient database
|
20 |
patients_db = []
|
@@ -30,10 +30,9 @@ disease_details = {
|
|
30 |
# Passwords
|
31 |
doctor_password = "doctor123"
|
32 |
|
33 |
-
|
34 |
-
|
35 |
try:
|
36 |
-
# Force using the slow tokenizer
|
37 |
tokenizer = AutoTokenizer.from_pretrained("harishussain12/PastelMed", use_fast=False)
|
38 |
except Exception as e:
|
39 |
print(f"Tokenizer error: {e}")
|
@@ -47,7 +46,8 @@ def consult_doctor(prompt):
|
|
47 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
48 |
return response
|
49 |
|
50 |
-
# Functions
|
|
|
51 |
def register_patient(name, age, gender, password):
|
52 |
patient_id = len(patients_db) + 1
|
53 |
patients_db.append({
|
|
|
6 |
import torch
|
7 |
import pandas as pd
|
8 |
|
9 |
+
# Load pre-trained zero-shot model for text classification (using PyTorch for compatibility)
|
10 |
+
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli", framework="pt")
|
11 |
|
12 |
+
# Pre-trained ResNet50 model for X-ray or image analysis using Timm
|
13 |
image_model = timm.create_model('resnet50', pretrained=True)
|
14 |
image_model.eval()
|
15 |
|
16 |
# Load saved TensorFlow eye disease detection model (TensorFlow Model without Keras)
|
17 |
+
eye_model = tf.keras.models.load_model('/content/model.h5')
|
18 |
|
19 |
# Patient database
|
20 |
patients_db = []
|
|
|
30 |
# Passwords
|
31 |
doctor_password = "doctor123"
|
32 |
|
33 |
+
# Loading the custom model for consultation with the doctor
|
|
|
34 |
try:
|
35 |
+
# Force using the slow tokenizer for compatibility
|
36 |
tokenizer = AutoTokenizer.from_pretrained("harishussain12/PastelMed", use_fast=False)
|
37 |
except Exception as e:
|
38 |
print(f"Tokenizer error: {e}")
|
|
|
46 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
47 |
return response
|
48 |
|
49 |
+
# Functions for the app
|
50 |
+
|
51 |
def register_patient(name, age, gender, password):
|
52 |
patient_id = len(patients_db) + 1
|
53 |
patients_db.append({
|