Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
import requests
|
| 4 |
+
from geopy.geocoders import Nominatim
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
API_URL = "https://api-inference.huggingface.co/models/dmis-lab/biobert-base-cased-v1.1"
|
| 8 |
+
headers = {"Authorization": "secret.toml"}
|
| 9 |
+
|
| 10 |
+
def query(payload):
|
| 11 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 12 |
+
return response.json()
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def main():
|
| 16 |
+
st.title("Healthcare Companion")
|
| 17 |
+
st.write("This app provides healthcare guidance, prescription information, and locates nearby clinics or pharmacies.")
|
| 18 |
+
|
| 19 |
+
# User input for medical question
|
| 20 |
+
question = st.text_input("Enter your medical question:")
|
| 21 |
+
if question:
|
| 22 |
+
context = "General medical context." # Adjust this as needed
|
| 23 |
+
result = query({"inputs": {"question": question, "context": context}})
|
| 24 |
+
st.write("**Answer:**")
|
| 25 |
+
st.write(result.get('answer', "Sorry, I don't know the answer."))
|
| 26 |
+
|
| 27 |
+
# User input for address to find nearby clinics/pharmacies
|
| 28 |
+
address = st.text_input("Enter your address to find nearby clinics/pharmacies:")
|
| 29 |
+
if address:
|
| 30 |
+
location = find_nearby_clinics(address)
|
| 31 |
+
st.write(f"**Nearby Clinics/Pharmacies (Coordinates):** {location}")
|
| 32 |
+
|
| 33 |
+
# Additional features like prescription info can be added similarly
|
| 34 |
+
|
| 35 |
+
if __name__ == "__main__":
|
| 36 |
+
main()
|