File size: 1,244 Bytes
6ccc896
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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()