Spaces:
Runtime error
Runtime error
ghengx
commited on
Commit
·
875bdcc
1
Parent(s):
89eac72
init
Browse files- app.py +18 -0
- dataset_loader.py +14 -0
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from dataset_loader import load_dataset
|
| 3 |
+
|
| 4 |
+
if not os.path.isdir('mystartup_data'):
|
| 5 |
+
load_dataset()
|
| 6 |
+
|
| 7 |
+
import gradio as gr
|
| 8 |
+
from mystartup_data.agent import Agent
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn=Agent().ask,
|
| 12 |
+
inputs=gr.components.Textbox(lines=7, label="Enter your text"),
|
| 13 |
+
outputs="text",
|
| 14 |
+
title="MyStartup Bot",
|
| 15 |
+
description="""This is a chatbot to answer your question regarding the MyStartup platform.
|
| 16 |
+
\nNotes: This chatbot does not implement the memory module, ask specific question and don't expect it remembers the last conversation."""
|
| 17 |
+
)
|
| 18 |
+
iface.launch(share=False)
|
dataset_loader.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import Repository
|
| 2 |
+
from huggingface_hub import login
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
def load_dataset():
|
| 6 |
+
login(token = os.environ['HUB_TOKEN'])
|
| 7 |
+
|
| 8 |
+
repo = Repository(
|
| 9 |
+
local_dir="mystartup_data",
|
| 10 |
+
repo_type="dataset",
|
| 11 |
+
clone_from="gheng/mystartup_data",
|
| 12 |
+
token=True
|
| 13 |
+
)
|
| 14 |
+
repo.git_pull()
|