TeacherPuffy commited on
Commit
a40cc94
·
verified ·
1 Parent(s): 0241b66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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 # Import time module for adding delays
 
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.decode('utf-8') # Assuming the file is encoded in UTF-8
 
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)