awacke1 commited on
Commit
f46ac02
1 Parent(s): 63b0d2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -8
app.py CHANGED
@@ -6,14 +6,30 @@ API_URL = 'https://qe55p8afio98s0u3.us-east-1.aws.endpoints.huggingface.cloud'
6
  API_KEY = os.getenv('API_KEY')
7
 
8
  headers = {
9
- "Authorization": "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
- return response.json()
16
-
17
- output = query({
18
- "inputs": "Write instructions to teach anyone to write a discharge plan. List the entities, features and relationships to CCDA and FHIR objects in boldface. ",
19
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ return response.json()
16
+
17
+ def get_output(prompt):
18
+ return query({"inputs": prompt})
19
+
20
+ def main():
21
+ st.title("Medical Transcription Summarizer")
22
+ example_input = st.text_input("Enter your example text:")
23
+
24
+ if st.button("Summarize with Variation 1"):
25
+ 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}"
26
+ output = get_output(prompt)
27
+ st.markdown(f"**Output:** {output}")
28
+
29
+ if st.button("Summarize with Variation 2"):
30
+ prompt = f"Provide a summary of the medical transcription. Highlight the important entities, features, and relationships to CCDA and FHIR objects. {example_input}"
31
+ output = get_output(prompt)
32
+ st.markdown(f"**Output:** {output}")
33
+
34
+ if __name__ == "__main__":
35
+ main()