Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -154,6 +154,8 @@ def log_on_azure(file, logs, share_client): 
     | 
|
| 154 | 
         | 
| 155 | 
         
             
            with gr.Blocks(title="π ClimateGPT", css="style.css") as demo:
         
     | 
| 156 | 
         | 
| 
         | 
|
| 
         | 
|
| 157 | 
         
             
                # Gradio
         
     | 
| 158 | 
         
             
                gr.Markdown("<h1><center>ClimateGPT π</center></h1>")
         
     | 
| 159 | 
         
             
                gr.Markdown("<h4><center>Ask climate-related questions to the IPCC reports</center></h4>")
         
     | 
| 
         @@ -270,32 +272,35 @@ ClimateGPT harnesses modern OCR techniques to parse and preprocess IPCC reports. 
     | 
|
| 270 | 
         
             
                )
         
     | 
| 271 | 
         
             
                ask.submit(reset_textbox, [], [ask])
         
     | 
| 272 | 
         | 
| 273 | 
         
            -
                with gr. 
     | 
| 274 | 
         
            -
                    gr. 
     | 
| 275 | 
         
            -
             
     | 
| 276 | 
         
            -
             
     | 
| 277 | 
         
            -
             
     | 
| 278 | 
         
            -
            - Provide feedback through our feedback form, letting us know which insights you found accurate, useful, or not. Your input will help us improve the platform.
         
     | 
| 279 | 
         
            -
            - To make climate science accessible to a wider audience, we have opened our own OpenAI API key with a monthly cap of $1000. If you already have an API key, please use it to help conserve bandwidth for others.
         
     | 
| 280 | 
         
            -
             
     | 
| 281 | 
         
            -
            ## Feedbacks
         
     | 
| 282 | 
         
            -
                    """)
         
     | 
| 283 | 
         | 
| 284 | 
         
            -
                     
     | 
| 285 | 
         
            -
                     
     | 
| 286 | 
         
            -
                     
     | 
| 287 | 
         
            -
                     
     | 
| 288 | 
         
            -
             
     | 
| 289 | 
         
            -
             
     | 
| 290 | 
         
            -
             
     | 
| 291 | 
         
            -
             
     | 
| 292 | 
         
            -
             
     | 
| 293 | 
         
            -
             
     | 
| 294 | 
         
            -
             
     | 
| 295 | 
         
            -
             
     | 
| 296 | 
         
            -
             
     | 
| 297 | 
         
            -
             
     | 
| 298 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 299 | 
         
             
                openai_api_key_textbox.change(
         
     | 
| 300 | 
         
             
                    set_openai_api_key, inputs=[openai_api_key_textbox]
         
     | 
| 301 | 
         
             
                )
         
     | 
| 
         @@ -306,7 +311,7 @@ ClimateGPT harnesses modern OCR techniques to parse and preprocess IPCC reports. 
     | 
|
| 306 | 
         
             
                gr.Markdown("""
         
     | 
| 307 | 
         | 
| 308 | 
         | 
| 309 | 
         
            -
            ## Sources
         
     | 
| 310 | 
         
             
            | Source | Report | URL | Number of pages | Release date |
         
     | 
| 311 | 
         
             
            | --- | --- | --- | --- | --- |
         
     | 
| 312 | 
         
             
            | IPCC | IPCC AR6 - First Assessment Report on the Physical Science of Climate Change | https://report.ipcc.ch/ar6/wg1/IPCC_AR6_WGI_FullReport.pdf | 2049 pages | August 2021 |
         
     | 
| 
         @@ -324,7 +329,7 @@ ClimateGPT harnesses modern OCR techniques to parse and preprocess IPCC reports. 
     | 
|
| 324 | 
         
             
            | IEA | Word Energy Outlook 2022 | https://www.iea.org/reports/world-energy-outlook-2022 | 524 pages | October 2022 |
         
     | 
| 325 | 
         
             
            | EU parliament | The environmental impacts of plastics and micro plastics use, waste and polution EU and national measures | https://www.europarl.europa.eu/thinktank/en/document/IPOL_STU(2020)658279 | 76 pages | October 2020 |
         
     | 
| 326 | 
         | 
| 327 | 
         
            -
            ## Carbon Footprint
         
     | 
| 328 | 
         | 
| 329 | 
         
             
            Carbon emissions were measured during the development and inference process using CodeCarbon [https://github.com/mlco2/codecarbon](https://github.com/mlco2/codecarbon)
         
     | 
| 330 | 
         | 
| 
         @@ -335,8 +340,10 @@ Carbon emissions were measured during the development and inference process usin 
     | 
|
| 335 | 
         
             
            | Inference | Question Answering | x kgCO2 / call | CodeCarbon |
         
     | 
| 336 | 
         
             
            | Inference | API call to turbo-GPT | x kgCO2 / call | OpenAI |
         
     | 
| 337 | 
         | 
| 338 | 
         
            -
            ##  
     | 
| 339 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 340 | 
         
             
            """)
         
     | 
| 341 | 
         | 
| 342 | 
         
             
                demo.queue(concurrency_count=16)
         
     | 
| 
         | 
|
| 154 | 
         | 
| 155 | 
         
             
            with gr.Blocks(title="π ClimateGPT", css="style.css") as demo:
         
     | 
| 156 | 
         | 
| 157 | 
         
            +
                user_id_state = gr.State([user_id])
         
     | 
| 158 | 
         
            +
                
         
     | 
| 159 | 
         
             
                # Gradio
         
     | 
| 160 | 
         
             
                gr.Markdown("<h1><center>ClimateGPT π</center></h1>")
         
     | 
| 161 | 
         
             
                gr.Markdown("<h4><center>Ask climate-related questions to the IPCC reports</center></h4>")
         
     | 
| 
         | 
|
| 272 | 
         
             
                )
         
     | 
| 273 | 
         
             
                ask.submit(reset_textbox, [], [ask])
         
     | 
| 274 | 
         | 
| 275 | 
         
            +
                with gr.Row():
         
     | 
| 276 | 
         
            +
                    with gr.Column(scale = 1):
         
     | 
| 277 | 
         
            +
                        with gr.Accordion("π Submit here your feedbacks and feature requests", open=True):
         
     | 
| 278 | 
         
            +
                            gr.Markdown("""
         
     | 
| 279 | 
         
            +
                    ## Beta test
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 280 | 
         | 
| 281 | 
         
            +
                    - ClimateGPT welcomes community contributions. To participate, head over to the Community Tab and create a "New Discussion" to ask questions and share your insights.
         
     | 
| 282 | 
         
            +
                    - Provide feedback through our feedback form, letting us know which insights you found accurate, useful, or not. Your input will help us improve the platform.
         
     | 
| 283 | 
         
            +
                    - To make climate science accessible to a wider audience, we have opened our own OpenAI API key with a monthly cap of $1000. If you already have an API key, please use it to help conserve bandwidth for others.
         
     | 
| 284 | 
         
            +
                    
         
     | 
| 285 | 
         
            +
                    ## Feedbacks
         
     | 
| 286 | 
         
            +
                            """)
         
     | 
| 287 | 
         
            +
                            
         
     | 
| 288 | 
         
            +
                            feedback = gr.Textbox()
         
     | 
| 289 | 
         
            +
                            feedback_save = gr.Button(value="submit feedback")
         
     | 
| 290 | 
         
            +
                            # thanks = gr.Textbox()
         
     | 
| 291 | 
         
            +
                            feedback_save.click(
         
     | 
| 292 | 
         
            +
                                save_feedback,
         
     | 
| 293 | 
         
            +
                                inputs=[feedback, user_id_state],  # outputs=[thanks]
         
     | 
| 294 | 
         
            +
                            )
         
     | 
| 295 | 
         
            +
             
     | 
| 296 | 
         
            +
                    with gr.Column(scale = 1):
         
     | 
| 297 | 
         
            +
                        with gr.Accordion("Add your personal openai api key - Optional (see beta-test section on the right)", open=False):
         
     | 
| 298 | 
         
            +
                            openai_api_key_textbox = gr.Textbox(
         
     | 
| 299 | 
         
            +
                                placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
         
     | 
| 300 | 
         
            +
                                show_label=False,
         
     | 
| 301 | 
         
            +
                                lines=1,
         
     | 
| 302 | 
         
            +
                                type="password",
         
     | 
| 303 | 
         
            +
                            )
         
     | 
| 304 | 
         
             
                openai_api_key_textbox.change(
         
     | 
| 305 | 
         
             
                    set_openai_api_key, inputs=[openai_api_key_textbox]
         
     | 
| 306 | 
         
             
                )
         
     | 
| 
         | 
|
| 311 | 
         
             
                gr.Markdown("""
         
     | 
| 312 | 
         | 
| 313 | 
         | 
| 314 | 
         
            +
            ## π Sources
         
     | 
| 315 | 
         
             
            | Source | Report | URL | Number of pages | Release date |
         
     | 
| 316 | 
         
             
            | --- | --- | --- | --- | --- |
         
     | 
| 317 | 
         
             
            | IPCC | IPCC AR6 - First Assessment Report on the Physical Science of Climate Change | https://report.ipcc.ch/ar6/wg1/IPCC_AR6_WGI_FullReport.pdf | 2049 pages | August 2021 |
         
     | 
| 
         | 
|
| 329 | 
         
             
            | IEA | Word Energy Outlook 2022 | https://www.iea.org/reports/world-energy-outlook-2022 | 524 pages | October 2022 |
         
     | 
| 330 | 
         
             
            | EU parliament | The environmental impacts of plastics and micro plastics use, waste and polution EU and national measures | https://www.europarl.europa.eu/thinktank/en/document/IPOL_STU(2020)658279 | 76 pages | October 2020 |
         
     | 
| 331 | 
         | 
| 332 | 
         
            +
            ## π’οΈ Carbon Footprint
         
     | 
| 333 | 
         | 
| 334 | 
         
             
            Carbon emissions were measured during the development and inference process using CodeCarbon [https://github.com/mlco2/codecarbon](https://github.com/mlco2/codecarbon)
         
     | 
| 335 | 
         | 
| 
         | 
|
| 340 | 
         
             
            | Inference | Question Answering | x kgCO2 / call | CodeCarbon |
         
     | 
| 341 | 
         
             
            | Inference | API call to turbo-GPT | x kgCO2 / call | OpenAI |
         
     | 
| 342 | 
         | 
| 343 | 
         
            +
            ## π§ Contact 
         
     | 
| 344 | 
         
            +
            This tool has been developed by the R&D lab at **Ekimetrics**
         
     | 
| 345 | 
         
            +
             
     | 
| 346 | 
         
            +
            If you have any questions or feature requests, please feel free to reach us out at <b>theo.alvesdacosta@ekimetrics.com</b>.
         
     | 
| 347 | 
         
             
            """)
         
     | 
| 348 | 
         | 
| 349 | 
         
             
                demo.queue(concurrency_count=16)
         
     |