import streamlit as st import requests # API processing function def analyze_blood_test(file, username, password, language='English'): url = 'https://app.aibloodtestinterpret.com/api/analyze' files = {'file': (file.name, file, 'multipart/form-data')} data = {'username': username, 'password': password, 'language': language} response = requests.post(url, files=files, data=data) return response # Main function for the Streamlit app def main(): # Custom CSS styling for the app st.markdown( """ """, unsafe_allow_html=True ) # App main content st.markdown( """
AI Blood Test Interpretation Logo
""", unsafe_allow_html=True ) st.sidebar.title('About') st.sidebar.info('''\ ### Free Trial Available Take advantage of our limited-time free trial for all humanity. ''') st.sidebar.info('''\ ### Product Release After 1.5 years of diligent effort, the AI Blood Test Interpretation tool is now officially launched. ''') st.sidebar.info('''\ ### AI Inventor Contact For any inquiries, please contact: emirhan@piya.ai ''') st.write('Welcome to the AI-driven Blood Test Interpreter. Upload your blood test file and get a detailed analysis within seconds.') uploaded_file = st.file_uploader('Upload your blood test image or PDF', type=['jpg', 'jpeg', 'png', 'pdf']) username = st.text_input('Username', value='demo') password = st.text_input('Password', value='demo', type='password') languages = [ 'English', 'Spanish', 'French', 'German', 'Italian', 'Portuguese', 'Dutch', 'Japanese', 'Chinese', 'Korean', 'Russian', 'Arabic', 'Hindi', 'Bengali', 'Turkish', 'Swedish', 'Norwegian', 'Danish', 'Finnish', 'Greek', 'Hebrew', 'Polish', 'Czech', 'Hungarian', 'Romanian', 'Bulgarian', 'Serbian', 'Croatian', 'Slovak', 'Slovenian', 'Ukrainian', 'Belarusian', 'Latvian', 'Lithuanian', 'Estonian', 'Macedonian', 'Albanian', 'Bosnian', 'Irish', 'Maltese', 'Icelandic', 'Welsh', 'Galician', 'Basque', 'Catalan', 'Afrikaans', 'Swahili', 'Zulu', 'Xhosa', 'Amharic', 'Yoruba', 'Igbo', 'Somali', 'Vietnamese', 'Thai', 'Filipino', 'Malay', 'Indonesian', 'Mongolian', 'Khmer', 'Sinhala', 'Burmese', 'Lao', 'Marathi', 'Gujarati', 'Punjabi', 'Tamil', 'Telugu', 'Kannada', 'Malayalam', 'Oriya', 'Assamese', 'Nepali', 'Pashto', 'Farsi', 'Urdu', 'Kurdish', 'Uzbek', 'Kazakh', 'Tajik', 'Turkmen', 'Kyrgyz', 'Azerbaijani', 'Armenian', 'Georgian', 'Haitian Creole', 'Javanese', 'Sundanese', 'Madurese', 'Minangkabau', 'Acehnese', 'Balinese', 'Batak', 'Buginese', 'Rejang', 'Sasak' ] language = st.selectbox('Report Language', languages) # Analyze button if st.button('Analyze'): if uploaded_file and username and password: response = analyze_blood_test(uploaded_file, username, password, language) if response.status_code == 200: st.success('Analysis completed successfully') pdf_filename = f"{uploaded_file.name.split('.')[0]}_results.pdf" with open(pdf_filename, 'wb') as pdf_file: pdf_file.write(response.content) with open(pdf_filename, 'rb') as pdf_file: st.download_button('Download PDF Report', data=pdf_file, file_name=pdf_filename) else: st.error(f"Failed to analyze file. Status code: {response.status_code}, Message: {response.json()}") else: st.warning('Please fill in all fields and upload a file.') if __name__ == '__main__': main()