Spaces:
Paused
Paused
BGarida commited on
Commit ·
1d550e6
1
Parent(s): fc1ab54
Deploying PDF Version v16
Browse files
app.py
CHANGED
|
@@ -111,18 +111,18 @@ async def start():
|
|
| 111 |
|
| 112 |
# Simulate upload progress
|
| 113 |
for i in range(0, 101, 10):
|
| 114 |
-
await msg.update(
|
| 115 |
if i < 100:
|
| 116 |
-
|
| 117 |
|
| 118 |
-
await msg.update(
|
| 119 |
|
| 120 |
try:
|
| 121 |
# Simulate processing progress
|
| 122 |
for i in range(0, 101, 10):
|
| 123 |
-
await msg.update(
|
| 124 |
if i < 100:
|
| 125 |
-
|
| 126 |
if i == 50:
|
| 127 |
# Actually process the file at the midpoint
|
| 128 |
chunks_with_metadata = process_file(file)
|
|
@@ -154,7 +154,7 @@ async def start():
|
|
| 154 |
)
|
| 155 |
|
| 156 |
cl.user_session.set("chain", chain)
|
| 157 |
-
await msg.update(
|
| 158 |
|
| 159 |
except Exception as e:
|
| 160 |
error_msg = f"An error occurred while processing the file: {str(e)}"
|
|
|
|
| 111 |
|
| 112 |
# Simulate upload progress
|
| 113 |
for i in range(0, 101, 10):
|
| 114 |
+
await msg.update(f"Uploading: {i}%")
|
| 115 |
if i < 100:
|
| 116 |
+
await cl.sleep(0.5) # Use cl.sleep instead of time.sleep
|
| 117 |
|
| 118 |
+
await msg.update(f"Upload complete. Now processing `{file.name}`...")
|
| 119 |
|
| 120 |
try:
|
| 121 |
# Simulate processing progress
|
| 122 |
for i in range(0, 101, 10):
|
| 123 |
+
await msg.update(f"Processing: {i}%")
|
| 124 |
if i < 100:
|
| 125 |
+
await cl.sleep(1) # Use cl.sleep instead of time.sleep
|
| 126 |
if i == 50:
|
| 127 |
# Actually process the file at the midpoint
|
| 128 |
chunks_with_metadata = process_file(file)
|
|
|
|
| 154 |
)
|
| 155 |
|
| 156 |
cl.user_session.set("chain", chain)
|
| 157 |
+
await msg.update(f"Processing `{file.name}` complete. You can now ask questions about the book!")
|
| 158 |
|
| 159 |
except Exception as e:
|
| 160 |
error_msg = f"An error occurred while processing the file: {str(e)}"
|