Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- README.md +2 -8
- app.py +29 -0
- hf-space-upload.ipynb +32 -4
README.md
CHANGED
@@ -1,8 +1,2 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
emoji: π§Ή
|
4 |
-
sdk: streamlit
|
5 |
-
sdk_version: 1.24.0
|
6 |
-
app_file: app.py
|
7 |
-
pinned: false
|
8 |
-
---
|
|
|
1 |
+
# llm-data-cleaner
|
2 |
+
Kaleidoscope Data - LLM Data Cleaner
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# this app is streamlit app for the current project hosted on huggingface spaces
|
2 |
+
|
3 |
+
import streamlit as st
|
4 |
+
from app.openai_chat_completion import OpenAIChatCompletions
|
5 |
+
|
6 |
+
st.title("Kaleidoscope Data - Data Cleaning LLM App")
|
7 |
+
|
8 |
+
st.write("This app is a demo of the LLM model for data cleaning. It is a work in progress and is not yet ready for production use.")
|
9 |
+
|
10 |
+
# text box or csv upload
|
11 |
+
text_input = st.text_input("Enter text", "Enter text here")
|
12 |
+
# csv_file = st.file_uploader("Upload CSV", type=['csv'])
|
13 |
+
|
14 |
+
# button to run data cleaning API on text via c class in openai_chat_completion.py
|
15 |
+
if st.button("Run Data Cleaning API"):
|
16 |
+
|
17 |
+
# if text_input is not empty, run data cleaning API on text_input
|
18 |
+
|
19 |
+
model = "gpt-4" # "gpt-3.5-turbo"
|
20 |
+
sys_mes = "prompts/gpt4-system-message.txt"
|
21 |
+
|
22 |
+
# instantiate OpenAIChatCompletions class
|
23 |
+
# get response from openai_chat_completion method
|
24 |
+
chat = OpenAIChatCompletions(model=model, system_message=sys_mes)
|
25 |
+
response = chat.openai_chat_completion(text_input, n_shot=5)
|
26 |
+
|
27 |
+
# display response
|
28 |
+
st.write(response)
|
29 |
+
|
hf-space-upload.ipynb
CHANGED
@@ -2,16 +2,36 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
"source": [
|
9 |
"from huggingface_hub import HfApi\n",
|
10 |
"api = HfApi()\n",
|
11 |
"\n",
|
12 |
"api.upload_folder(\n",
|
13 |
-
" folder_path=\"
|
14 |
-
" repo_id=\"
|
15 |
" repo_type=\"space\",\n",
|
16 |
")"
|
17 |
]
|
@@ -24,7 +44,15 @@
|
|
24 |
"name": "python3"
|
25 |
},
|
26 |
"language_info": {
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
"name": "python",
|
|
|
|
|
28 |
"version": "3.10.11"
|
29 |
},
|
30 |
"orig_nbformat": 4
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
"metadata": {},
|
7 |
+
"outputs": [
|
8 |
+
{
|
9 |
+
"name": "stderr",
|
10 |
+
"output_type": "stream",
|
11 |
+
"text": [
|
12 |
+
"/Users/christos/opt/miniconda3/envs/kd-llm-dc/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
13 |
+
" from .autonotebook import tqdm as notebook_tqdm\n",
|
14 |
+
"run-rbtf91s6.wandb: 100%|ββββββββββ| 7.96M/7.96M [00:16<00:00, 488kB/s] \n"
|
15 |
+
]
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"data": {
|
19 |
+
"text/plain": [
|
20 |
+
"'https://huggingface.co/spaces/kaleidoscope-data/data-cleaning-llm/tree/main/'"
|
21 |
+
]
|
22 |
+
},
|
23 |
+
"execution_count": 1,
|
24 |
+
"metadata": {},
|
25 |
+
"output_type": "execute_result"
|
26 |
+
}
|
27 |
+
],
|
28 |
"source": [
|
29 |
"from huggingface_hub import HfApi\n",
|
30 |
"api = HfApi()\n",
|
31 |
"\n",
|
32 |
"api.upload_folder(\n",
|
33 |
+
" folder_path=\"\",\n",
|
34 |
+
" repo_id=\"kaleidoscope-data/data-cleaning-llm\",\n",
|
35 |
" repo_type=\"space\",\n",
|
36 |
")"
|
37 |
]
|
|
|
44 |
"name": "python3"
|
45 |
},
|
46 |
"language_info": {
|
47 |
+
"codemirror_mode": {
|
48 |
+
"name": "ipython",
|
49 |
+
"version": 3
|
50 |
+
},
|
51 |
+
"file_extension": ".py",
|
52 |
+
"mimetype": "text/x-python",
|
53 |
"name": "python",
|
54 |
+
"nbconvert_exporter": "python",
|
55 |
+
"pygments_lexer": "ipython3",
|
56 |
"version": "3.10.11"
|
57 |
},
|
58 |
"orig_nbformat": 4
|