Create backupapp.py
Browse files- backupapp.py +36 -0
backupapp.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import streamlit as st
|
3 |
+
import os
|
4 |
+
|
5 |
+
API_URL = 'https://qe55p8afio98s0u3.us-east-1.aws.endpoints.huggingface.cloud'
|
6 |
+
API_KEY = os.getenv('API_KEY')
|
7 |
+
|
8 |
+
headers = {
|
9 |
+
"Authorization": f"Bearer {API_KEY}",
|
10 |
+
"Content-Type": "application/json"
|
11 |
+
}
|
12 |
+
|
13 |
+
def query(payload):
|
14 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
15 |
+
st.markdown(response.json())
|
16 |
+
return response.json()
|
17 |
+
|
18 |
+
def get_output(prompt):
|
19 |
+
return query({"inputs": prompt})
|
20 |
+
|
21 |
+
def main():
|
22 |
+
st.title("Medical Transcription Summarizer")
|
23 |
+
example_input = st.text_input("Enter your example text:")
|
24 |
+
|
25 |
+
if st.button("Summarize with Variation 1"):
|
26 |
+
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}"
|
27 |
+
output = get_output(prompt)
|
28 |
+
st.markdown(f"**Output:** {output}")
|
29 |
+
|
30 |
+
if st.button("Summarize with Variation 2"):
|
31 |
+
prompt = f"Provide a summary of the medical transcription. Highlight the important entities, features, and relationships to CCDA and FHIR objects. {example_input}"
|
32 |
+
output = get_output(prompt)
|
33 |
+
st.markdown(f"**Output:** {output}")
|
34 |
+
|
35 |
+
if __name__ == "__main__":
|
36 |
+
main()
|