NasrinRipa commited on
Commit
c5059f6
·
1 Parent(s): 4f86459

initial commit

Browse files
Files changed (4) hide show
  1. Drug_Book.joblib +3 -0
  2. app.py +27 -0
  3. drug_book_knn.joblib +3 -0
  4. requirements.txt +2 -0
Drug_Book.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33e85e2013cd38386a0137584c80bf09feb89fff37ad1f8b5d06034d82d8d90c
3
+ size 12588296
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+ from joblib import load
4
+
5
+ # Load the saved model
6
+ model_file = "Drug_Book.joblib"
7
+ loaded_model = load(model_file)
8
+
9
+ def predict_drug(text_input):
10
+ # Perform prediction using the loaded model
11
+ prediction = loaded_model.predict([text_input])[0]
12
+ drug_name = prediction[0]
13
+ drug_uses = prediction[1]
14
+ drug_dosage = prediction[2]
15
+
16
+ output_text = f"DRUG NAME:\n {drug_name}, \n\nDRUG USES:\n {drug_uses}, \n\nDRUG DOSAGE:\n {drug_dosage}\n"
17
+ return output_text
18
+
19
+ # Create the interface
20
+ iface = gr.Interface(
21
+ fn=predict_drug,
22
+ inputs=gr.inputs.Textbox(lines=3, label="Input Text"),
23
+ outputs=gr.outputs.Textbox(label="\n\nPredicted drug details\n\n")
24
+ )
25
+
26
+ # Launch the interface
27
+ iface.launch()
drug_book_knn.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:155e6867f4b51d415b05fc954652f427c8ce9765e3f3ee2e5a55731640985eeb
3
+ size 4754239
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio==3.40.0
2
+ torch==1.13.1