Spaces:
Sleeping
Sleeping
Update app.py
#2
by
npcJensen
- opened
app.py
CHANGED
|
@@ -1,35 +1,39 @@
|
|
| 1 |
-
#import certain libraies
|
| 2 |
-
import gradio as gr
|
| 3 |
-
from test import ai_chatbot
|
| 4 |
-
import json
|
| 5 |
-
import os
|
| 6 |
-
|
| 7 |
-
#using the json file
|
| 8 |
-
with open(os.path.abspath(os.path.join(os.path.dirname(__file__),"branding.json"))) as file:
|
| 9 |
-
brand_info = json.load(file)["brand"]
|
| 10 |
-
|
| 11 |
-
#using the gradio lib
|
| 12 |
-
with gr.Blocks(theme="default",title=brand_info["organizationName"]) as app:
|
| 13 |
-
gr.HTML(f"""
|
| 14 |
-
<div style="display: flex; justify-content:center; margin-bottom:20px">
|
| 15 |
-
<img src="{brand_info["logo"]["title"]}" alt="{brand_info["organizationName"]} Logo" style ="width:200px;height:40px">
|
| 16 |
-
</div> """)
|
| 17 |
-
|
| 18 |
-
#creation of chatbot
|
| 19 |
-
gr.ChatInterface (
|
| 20 |
-
fn = ai_chatbot,
|
| 21 |
-
chatbot = gr.Chatbot(height=400 ,avatar_images=(None,brand_info["chatbot"]["avatar"]),
|
| 22 |
-
type = "messages"),
|
| 23 |
-
title = brand_info["organizationName"],
|
| 24 |
-
description= brand_info["slogan"],
|
| 25 |
-
type = "messages",
|
| 26 |
-
examples=[
|
| 27 |
-
["Who are you!"],
|
| 28 |
-
["What is the role of ML in AI?"],
|
| 29 |
-
["What is you favorite choice of ice-cream flavor"]
|
| 30 |
-
]
|
| 31 |
-
|
| 32 |
-
)
|
| 33 |
-
if __name__ == "__main__":
|
| 34 |
-
app.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
|
|
|
| 1 |
+
#import certain libraies
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from test import ai_chatbot
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
#using the json file
|
| 8 |
+
with open(os.path.abspath(os.path.join(os.path.dirname(__file__),"branding.json"))) as file:
|
| 9 |
+
brand_info = json.load(file)["brand"]
|
| 10 |
+
|
| 11 |
+
#using the gradio lib
|
| 12 |
+
with gr.Blocks(theme="default",title=brand_info["organizationName"]) as app:
|
| 13 |
+
gr.HTML(f"""
|
| 14 |
+
<div style="display: flex; justify-content:center; margin-bottom:20px">
|
| 15 |
+
<img src="{brand_info["logo"]["title"]}" alt="{brand_info["organizationName"]} Logo" style ="width:200px;height:40px">
|
| 16 |
+
</div> """)
|
| 17 |
+
|
| 18 |
+
#creation of chatbot
|
| 19 |
+
gr.ChatInterface (
|
| 20 |
+
fn = ai_chatbot,
|
| 21 |
+
chatbot = gr.Chatbot(height=400 ,avatar_images=(None,brand_info["chatbot"]["avatar"]),
|
| 22 |
+
type = "messages"),
|
| 23 |
+
title = brand_info["organizationName"],
|
| 24 |
+
description= brand_info["slogan"],
|
| 25 |
+
type = "messages",
|
| 26 |
+
examples=[
|
| 27 |
+
["Who are you!"],
|
| 28 |
+
["What is the role of ML in AI?"],
|
| 29 |
+
["What is you favorite choice of ice-cream flavor"]
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
)
|
| 33 |
+
if __name__ == "__main__":
|
| 34 |
+
app.launch()
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
|