Spaces:
Runtime error
Runtime error
Download app.py from ctohereandnowai/webchatbot: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/ctohereandnowai/webchatbot/resolve/main/app.py
- Command line
-
hf download hf://spaces/ctohereandnowai/webchatbot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ctohereandnowai/webchatbot/resolve/main/app.py
1.1 kB
| import gradio as gr | |
| from rag_pdf import get_response | |
| import json | |
| import os | |
| with open(os.path.abspath(os.path.join(os.path.dirname(__file__), "branding.json"))) as f: | |
| brand_info = json.load(f)["brand"] | |
| with gr.Blocks(theme="default", title=brand_info["organizationName"]) as app: | |
| gr.HTML(f"""<div style="display: flex; justify-content: center; margin-bottom: 20px;"> | |
| <img src="{brand_info["logo"]["title"]}" alt="{brand_info["organizationName"]} Logo" style="height: 100px;"> | |
| </div>""") | |
| gr.ChatInterface( | |
| fn=get_response, | |
| chatbot=gr.Chatbot(height=500, | |
| avatar_images=(None, brand_info["chatbot"]["avatar"]), | |
| type="messages"), | |
| title=brand_info["organizationName"], | |
| description=brand_info["slogan"], | |
| type="messages", | |
| examples=[ | |
| ["who is the cto"], | |
| ["who is madam Deepti"], | |
| ["what are the courses offered by Hereandnowai"], | |
| ] | |
| ) | |
| if __name__ == "__main__": | |
| app.launch() | |