Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,7 +93,7 @@ max_length = st.sidebar.slider("Max Length", min_value=50, max_value=1024, value
|
|
| 93 |
# Load the model and tokenizer
|
| 94 |
@st.cache_resource
|
| 95 |
def load_model_and_tokenizer():
|
| 96 |
-
model_path = "
|
| 97 |
|
| 98 |
# Load model and tokenizer
|
| 99 |
tokenizer = AutoTokenizer.from_pretrained(model_path) # Use GPT-2 tokenizer from Hugging Face
|
|
@@ -153,7 +153,7 @@ def save_chat_data(chat_data):
|
|
| 153 |
|
| 154 |
# Function to handle uploaded text or PDF files and convert PDF to txt
|
| 155 |
def handle_uploaded_file(uploaded_file):
|
| 156 |
-
dataset_dir = "
|
| 157 |
dataset_path = Path(dataset_dir) / f"{uploaded_file.name}.txt"
|
| 158 |
|
| 159 |
# Check if the file is a PDF
|
|
|
|
| 93 |
# Load the model and tokenizer
|
| 94 |
@st.cache_resource
|
| 95 |
def load_model_and_tokenizer():
|
| 96 |
+
model_path = "gpt2" # Path to the local model directory
|
| 97 |
|
| 98 |
# Load model and tokenizer
|
| 99 |
tokenizer = AutoTokenizer.from_pretrained(model_path) # Use GPT-2 tokenizer from Hugging Face
|
|
|
|
| 153 |
|
| 154 |
# Function to handle uploaded text or PDF files and convert PDF to txt
|
| 155 |
def handle_uploaded_file(uploaded_file):
|
| 156 |
+
dataset_dir = "./datasets"
|
| 157 |
dataset_path = Path(dataset_dir) / f"{uploaded_file.name}.txt"
|
| 158 |
|
| 159 |
# Check if the file is a PDF
|