Spaces:
Running
Running
TeacherPuffy
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,8 @@ import gradio as gr
|
|
2 |
from gradio_client import Client
|
3 |
from huggingface_hub import HfApi
|
4 |
import logging
|
5 |
-
import time
|
|
|
6 |
|
7 |
# Set up logging
|
8 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
@@ -41,7 +42,8 @@ def process_text(file, prompt):
|
|
41 |
logger.info("Starting text processing...")
|
42 |
|
43 |
# Read the text directly from the uploaded file
|
44 |
-
text = file
|
|
|
45 |
|
46 |
# Segment the text into chunks
|
47 |
chunks = segment_text(text)
|
|
|
2 |
from gradio_client import Client
|
3 |
from huggingface_hub import HfApi
|
4 |
import logging
|
5 |
+
import time
|
6 |
+
import os
|
7 |
|
8 |
# Set up logging
|
9 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
|
|
42 |
logger.info("Starting text processing...")
|
43 |
|
44 |
# Read the text directly from the uploaded file
|
45 |
+
text = file # The file content is already a string
|
46 |
+
logger.info(f"Text length: {len(text)} characters.")
|
47 |
|
48 |
# Segment the text into chunks
|
49 |
chunks = segment_text(text)
|