|
import streamlit as st |
|
from transformers import pipeline |
|
import requests |
|
from geopy.geocoders import Nominatim |
|
|
|
|
|
API_URL = "https://api-inference.huggingface.co/models/dmis-lab/biobert-base-cased-v1.1" |
|
headers = {"Authorization": "secret"} |
|
|
|
def query(payload): |
|
response = requests.post(API_URL, headers=headers, json=payload) |
|
return response.json() |
|
|
|
|
|
def main(): |
|
st.title("Healthcare Companion") |
|
st.write("This app provides healthcare guidance, prescription information, and locates nearby clinics or pharmacies.") |
|
|
|
|
|
question = st.text_input("Enter your medical question:") |
|
if question: |
|
context = "General medical context." |
|
result = query({"inputs": {"question": question, "context": context}}) |
|
st.write("**Answer:**") |
|
st.write(result.get('answer', "Sorry, I don't know the answer.")) |
|
|
|
|
|
address = st.text_input("Enter your address to find nearby clinics/pharmacies:") |
|
if address: |
|
location = find_nearby_clinics(address) |
|
st.write(f"**Nearby Clinics/Pharmacies (Coordinates):** {location}") |
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
main() |
|
|