Update app.py
Browse files10 unmodified lines111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667103 unmodified lines17117217317417517610 unmodified linesneutral_hue="lime",)# Define the function to change the font based on the dropdown selection.def change_font(font):if font == "Open dyslexic":gr.HTML('''<style>@fontface {font-family: openDyslexic;src: url(Open_Dyslexic-Regular.otf);}body {font-family: openDyslexic;}<style/> ''')else:font_family = "Arial"return# Define the function to handle chatbot responses and maintain history.def echo_bot(user_input, history):history.append((user_input, user_input))return "", history# Create the Gradio app.with gr.Blocks(theme=theme_citrus) as demo:with gr.Row():with gr.Column(scale=1):# Dropdown menu for font selection.font_dropdown = gr.Dropdown(choices=["Open dyslexic", "Normal"], label="Select Font")apply_button = gr.Button("Apply Font")text_output = gr.Markdown("Sample text here")apply_button.click(fn=change_font, inputs=font_dropdown, outputs=text_output)with gr.Column(scale=19):# Image component.gr.Image('ecosphere.png')# Projects section.with gr.Row(scale=9):with gr.Column(scale=3):with gr.Group():gr.Markdown('GET INVOLVED')with gr.Group():gr.HTML('<a href="https://fridaysforfuture.org/" target="_blank">FRIDAYS FOR FUTURE</a>')gr.HTML('<a href="https://www.sunrisemovement.org/" target="_blank">SUNRISE MOVEMENT</a>')gr.HTML('<a href="https://thisiszerohour.org/" target="_blank">ZERO HOUR</a>')gr.Markdown('Outside the US')gr.HTML('<a href="https://community.youth4climate.info/homepage" target="_blank">Youth4Climate (EU)</a>')gr.HTML('<a href="https://www.instagram.com/fridaysforfuturemapa/?hl=de" target="_blank">Fridays for Future MAPA (Africa, Latin America, Asia-Pacific) </a>')with gr.Column(scale=7):gr.ChatInterface(respond, type="messages")#sustainability tipsSUSTAINABILITY_TIPS = ["Bring your own: Carry a reusable water bottle, coffee cup, and shopping bag.",103 unmodified linesrelevant_info = cleaned_chunks[indices]top_chunks.append(relevant_info)return top_chunksdemo.launch()10 unmodified lines111213141516103 unmodified lines12012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217310 unmodified linesneutral_hue="lime",)#sustainability tipsSUSTAINABILITY_TIPS = ["Bring your own: Carry a reusable water bottle, coffee cup, and shopping bag.",103 unmodified linesrelevant_info = cleaned_chunks[indices]top_chunks.append(relevant_info)return top_chunks# Define the function to change the font based on the dropdown selection.def change_font(font):if font == "Open dyslexic":gr.HTML('''<style>@fontface {font-family: openDyslexic;src: url(Open_Dyslexic-Regular.otf);}body {font-family: openDyslexic;}<style/> ''')else:font_family = "Arial"return# Define the function to handle chatbot responses and maintain history.def echo_bot(user_input, history):history.append((user_input, user_input))return "", history# Create the Gradio app.with gr.Blocks(theme=theme_citrus) as demo:with gr.Row():with gr.Column(scale=1):# Dropdown menu for font selection.font_dropdown = gr.Dropdown(choices=["Open dyslexic", "Normal"], label="Select Font")apply_button = gr.Button("Apply Font")text_output = gr.Markdown("Sample text here")apply_button.click(fn=change_font, inputs=font_dropdown, outputs=text_output)with gr.Column(scale=19):# Image component.gr.Image('ecosphere.png')# Projects section.with gr.Row(scale=9):with gr.Column(scale=3):with gr.Group():gr.Markdown('GET INVOLVED')with gr.Group():gr.HTML('<a href="https://fridaysforfuture.org/" target="_blank">FRIDAYS FOR FUTURE</a>')gr.HTML('<a href="https://www.sunrisemovement.org/" target="_blank">SUNRISE MOVEMENT</a>')gr.HTML('<a href="https://thisiszerohour.org/" target="_blank">ZERO HOUR</a>')gr.Markdown('Outside the US')gr.HTML('<a href="https://community.youth4climate.info/homepage" target="_blank">Youth4Climate (EU)</a>')gr.HTML('<a href="https://www.instagram.com/fridaysforfuturemapa/?hl=de" target="_blank">Fridays for Future MAPA (Africa, Latin America, Asia-Pacific) </a>')with gr.Column(scale=7):gr.ChatInterface(respond, type="messages")demo.launch()
app.py+48-51