Spaces:
Runtime error
Runtime error
Commit
·
df8424e
1
Parent(s):
718e9f2
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,9 +16,11 @@ tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
|
| 16 |
model = PeftModel.from_pretrained(model, peft_model_id)
|
| 17 |
|
| 18 |
|
| 19 |
-
def make_inference(
|
| 20 |
batch = tokenizer(
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
return_tensors="pt",
|
| 23 |
)
|
| 24 |
|
|
@@ -35,10 +37,10 @@ if __name__ == "__main__":
|
|
| 35 |
gr.Interface(
|
| 36 |
make_inference,
|
| 37 |
[
|
| 38 |
-
gr.inputs.Textbox(lines=2, label="
|
| 39 |
-
gr.inputs.Textbox(lines=5, label="
|
| 40 |
],
|
| 41 |
-
gr.outputs.Textbox(label="
|
| 42 |
-
title="
|
| 43 |
-
description="
|
| 44 |
).launch()
|
|
|
|
| 16 |
model = PeftModel.from_pretrained(model, peft_model_id)
|
| 17 |
|
| 18 |
|
| 19 |
+
def make_inference(question: str)->str:
|
| 20 |
batch = tokenizer(
|
| 21 |
+
"Below is a question, please write an answer for this question.\n\n"
|
| 22 |
+
f"### Question:\n{question}\n\n### Answer:\n",
|
| 23 |
+
#f"Below is a product and description, please write a marketing email for this product.\n\n### Product:\n{product}\n### Description:\n{description}\n\n### Marketing Email",
|
| 24 |
return_tensors="pt",
|
| 25 |
)
|
| 26 |
|
|
|
|
| 37 |
gr.Interface(
|
| 38 |
make_inference,
|
| 39 |
[
|
| 40 |
+
gr.inputs.Textbox(lines=2, label="Medical Condition"),
|
| 41 |
+
#gr.inputs.Textbox(lines=5, label="Medical Condition Description"),
|
| 42 |
],
|
| 43 |
+
gr.outputs.Textbox(label="Medical"),
|
| 44 |
+
title="MedChatBot",
|
| 45 |
+
description="MedChatBot is a tool that helps physicians with confidence in cancer diagnosis",
|
| 46 |
).launch()
|