# -*- coding: utf-8 -*-
"""
Created on Tue Jun 29 22:48:50 2021

@author: admin
"""

import streamlit as st
import numpy as np
import time
hide_streamlit_style = """            
                       <style>            
                       #MainMenu {visibility: hidden;}            
                       footer {visibility: hidden;}            
                       </style>            
                       """
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
st.sidebar.title("Go to 🧭")
    # Widget to select your page, you can choose between radio buttons or a selectbox
page = st.sidebar.radio(" ", ('Home','Education','Projects','Experience and virtual internships'))
if page == "Home":
    # Display details of page 1
    st.title("Hello, Welcome to my portfolio!")
    status_text = st.sidebar.empty()
    last_rows = np.random.randn(1, 1)
    chart = st.line_chart(last_rows,height = 300,width = 800)
    
    
    for i in range(1, 101):
        new_rows = last_rows[-1, :] + np.random.randn(8, 1).cumsum(axis=0)
        chart.add_rows(new_rows)
        last_rows = new_rows
        time.sleep(0.0001)
    
    st.header('About me:')
    st.image('https://lh4.googleusercontent.com/m5elwvQUrXOkXPmRgb-xnJft62w-nVcMca6finXnoCPMboRqtj2s6h57lJul3A3KGu_Y1V9Y8W1hSq2Dz0QsvSp3ihuUeir_q6Z9JCwYtZ20tINDtyUh5BTA_q9FQSdh7w=w1280',width = 700)
    st.write("I am an undergraduate student with a major in Aerospace engineering. I love to solve problems, be it in design, or engineering. I am currently working as a consultant, at 180 Degrees Consulting, IIT Kharagpur, primarily working on social media posts and design problems. I am an enthusiastic learner, eager to know new things. I practice yoga for relaxation, occasionally cook to satiate my foodie cravings.")
    #st.markdown(page_bg_img, unsafe_allow_html=True)
    st.write('You can contact me on bhargaviadusumilli183@gmail.com')
elif page == "Projects":
    st.title('Projects')
    project = st.selectbox('Select one',['Weather','White board'])
    # Display details of page 2
    # -*- coding: utf-8 -*-
#    """
#    Created on Sat Apr  3 13:39:33 2021
#    @author: admin
#    """
    
    # -*- coding: utf-8 -*-
    #"""Weather.ipynb
    #Automatically generated by Colaboratory.
    #Original file is located at
    #    https://colab.research.google.com/drive/1j2KV078KZgtld37aeGstl2pRGu2I25FA
    #"""
    
    #pip install pyowm streamlit datetime pytz
    if project == 'Weather':
        import os
        import pytz
        import pyowm
        import streamlit as st
        import numpy as np
        from matplotlib import dates
        from datetime import datetime
        from matplotlib import pyplot as plt
        import requests, json
        
        owm=pyowm.OWM('your-api-key')
        mgr=owm.weather_manager()
        #api_key = "Your_API_Key"
        
        api_key = "dd1a9be51e2fb72d243de4e4fc388f54"
        
        st.title("Know the Weather in your city")
        st.write("Made by Bhargavi with ♥")
        st.write("### Write the name of a City")
        place=st.text_input("Enter the city name :"," ")
        if place == " ":
            st.write("Input a CITY!")
        st.button("submit")
        
        import time
        base_url = "http://api.openweathermap.org/data/2.5/weather?"
        complete_url = base_url + "appid=" + api_key + "&q=" + place
        response = requests.get(complete_url)
          
        # Enter your API key here
        api_key = "dd1a9be51e2fb72d243de4e4fc388f54"
          
        # base_url variable to store url
        base_url = "http://api.openweathermap.org/data/2.5/weather?"
          
        # Give city name
        city_name = place
          
        # complete_url variable to store
        # complete url address
        complete_url = base_url + "appid=" + api_key + "&q=" + city_name
          
        # get method of requests module
        # return response object
        response = requests.get(complete_url)
          
        # json method of response object 
        # convert json format data into
        # python format data
        x = response.json()
          
        # Now x contains list of nested dictionaries
        # Check the value of "cod" key is equal to
        # "404", means city is found otherwise,
        # city is not found
        if x["cod"] != "404" and " ":
            # store the value of "main"
            # key in variable y
            y = x["main"]
            # store the value corresponding
            # to the "temp" key of y
            current_temperature = y["temp"]
          
            # store the value corresponding
            # to the "pressure" key of y
            current_pressure = y["pressure"]
          
            # store the value corresponding
            # to the "humidity" key of y
            current_humidity = y["humidity"]
          
            # store the value of "weather"
            # key in variable z
            z = x["weather"]
          
            # store the value corresponding 
            # to the "description" key at 
            # the 0th index of z
            weather_description = z[0]["description"]
          
            # print following values
            st.write(" Temperature (in Celsius) = ",(current_temperature-273)," Celsius")
            st.write("atmospheric pressure (in hPa unit) = ",current_pressure)
            st.write(" humidity (in percentage) = ",current_humidity, "%")
            st.write(" description = ",weather_description)
        elif  place == " ":
            st.subheader(" ")
        else:
            st.subheader("Error:please enter a city name")
        st.write("### Description of the app")
        st.write("It is a python application made using Pyowm and Streamlit packages, which shows the weather conditions when a city name is entered.The weather conditions shown are temperature, pressure, humidity, and description of the climate. Weather data is fetched from API using PYOWM package.")
        import webbrowser
    
        url = 'https://github.com/bhargavi157/self_projects/blob/main/weather.py'
        
        if st.button('Link to the code'):
            webbrowser.open_new_tab(url)
            
elif page == "Experience and virtual internships":
    # Display details of page
    st.title('Experience and virtual internships')
    st.subheader('Data Science Intern | Widhya (Jan 2021 - Feb 2021)')
    st.write('• Predicted Bitcoin price using linear regression, performed exploratory data analysis and accuracy tests to evaluate the model')
    st.write('• Performed data analysis on COVID - 19 cases in India (over 2 months of data), modelled an exponential function to fit the data')
    st.write('• Predicted prices of Apple stock by linear regression algorithm, using Quandl package to fetch the stock price data from API and visualised data using Pandas, Maltplotlib and Seaborn plots')
    st.subheader('Data Science and Business Analytics Intern | The Sparks Foundation (April 2021 - May 2021)')
    st.write('• Prepared an interactive dashboard showing the spread of COVID-19 disease in India using Tableau software')
    st.write('• Predicted the percentage of marks of a student based on the no. of study hours using Linear Regression algorithm from scratch, with a regression score of 0.953')
    st.subheader('JPMorgan Chase &Co.Software Engineering Virtual Experience Program Participant')
    st.write('Participated in the open access JPMorgan Chase &Co. Virtual Experience Program with Forage. Tasks completed include:')
    st.write('• Interface with a stock price data feed')
    st.write('• Implemented the Perspective open source code in preparation for data visualization')
    st.write('• Used Perspective to create the chart for the trader’s dashboard')
    st.write('• Made a contribution to Perspective')
elif page == "Education":
    # Display details of page
    st.header('My Education')
    st.image('https://bsmedia.business-standard.com/_media/bs/img/article/2016-10/17/full/1476705933-6474.jpg', width = 700)
    st.write('I am currently pursuing my Bachelors in Aerospace engineering at IIT Kharagpur. I am passionate about data science and love working with data visualisations. I am currently learning data structure and algorithms through online resources, to improve my programming skills. I have done some mini projects in data science and currently exploring the field of machine learning.')
     
