cjzhi98 commited on
Commit
2d5ffb4
1 Parent(s): 295e0cb

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +27 -0
  2. dataset_loader.py +18 -0
  3. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ from dataset_loader import load_dataset
4
+
5
+ if not os.path.isdir("gift_recommending_chatbot_data"):
6
+ load_dataset()
7
+
8
+ from gift_recommending_chatbot_data.utils import generate_gift_suggestion
9
+
10
+
11
+ # Initialize the conversation
12
+ conversation = []
13
+
14
+
15
+ # Create the Gradio interface
16
+ iface = gr.Interface(
17
+ title="Gift Recommending Chatbot",
18
+ fn=generate_gift_suggestion,
19
+ inputs="text",
20
+ outputs="text",
21
+ description="You can get the facebook username by his/her facebook profile link. e.g. https://www.facebook.com/username, paste in the {username}",
22
+ )
23
+
24
+ iface.queue(default_concurrency_limit=None)
25
+
26
+ # Launch the app
27
+ iface.launch()
dataset_loader.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import Repository
2
+ from huggingface_hub import login
3
+ import os
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv()
7
+
8
+
9
+ def load_dataset():
10
+ login(token=os.getenv("HUB_TOKEN"))
11
+
12
+ repo = Repository(
13
+ local_dir="gift_recommending_chatbot_data",
14
+ repo_type="dataset",
15
+ clone_from="cjzhi98/gift-recommending-chatbot",
16
+ token=True,
17
+ )
18
+ repo.git_pull()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio
2
+ huggingface_hub
3
+ facebook_scraper
4
+ lxml_html_clean
5
+ openai