awacke1's picture
Update app.py
9264b57
raw
history blame
1.24 kB
import requests
import streamlit as st
import os
API_URL = 'https://qe55p8afio98s0u3.us-east-1.aws.endpoints.huggingface.cloud'
API_KEY = os.getenv('API_KEY')
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
st.markdown(response.json())
return response.json()
def get_output(prompt):
return query({"inputs": prompt})
def main():
st.title("Medical Transcription Summarizer")
example_input = st.text_input("Enter your example text:")
if st.button("Summarize with Variation 1"):
prompt = f"Write instructions to teach anyone to write a discharge plan. List the entities, features and relationships to CCDA and FHIR objects in boldface. {example_input}"
output = get_output(prompt)
st.markdown(f"**Output:** {output}")
if st.button("Summarize with Variation 2"):
prompt = f"Provide a summary of the medical transcription. Highlight the important entities, features, and relationships to CCDA and FHIR objects. {example_input}"
output = get_output(prompt)
st.markdown(f"**Output:** {output}")
if __name__ == "__main__":
main()