Create gpt_output.py
Browse files- gpt_output.py +28 -0
gpt_output.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
from PIL import Image
|
| 4 |
+
from io import BytesIO
|
| 5 |
+
|
| 6 |
+
st.title("AI Copilot for Primary Care Physicians")
|
| 7 |
+
|
| 8 |
+
name = st.text_input("Enter your name:")
|
| 9 |
+
prompt_file = st.file_uploader("Upload prompt file:")
|
| 10 |
+
context_file = st.file_uploader("Upload context file:")
|
| 11 |
+
|
| 12 |
+
if st.button("Submit"):
|
| 13 |
+
if prompt_file and context_file:
|
| 14 |
+
files = {
|
| 15 |
+
"prompt": prompt_file.getvalue(),
|
| 16 |
+
"file": context_file.getvalue(),
|
| 17 |
+
}
|
| 18 |
+
response = requests.post(
|
| 19 |
+
"https://fastapi-gpt-v20.livelysmoke-91761759.centralus.azurecontainerapps.io/uploadPrompt",
|
| 20 |
+
params={"name": name},
|
| 21 |
+
files=files,
|
| 22 |
+
)
|
| 23 |
+
if response.status_code == 200:
|
| 24 |
+
st.success("Files uploaded successfully!")
|
| 25 |
+
else:
|
| 26 |
+
st.error("Error uploading files.")
|
| 27 |
+
else:
|
| 28 |
+
st.warning("Please upload both files before submitting.")
|