drewThomasson
commited on
Commit
•
1febdfb
1
Parent(s):
0ebe92b
Update app.py
Browse files
app.py
CHANGED
@@ -54,11 +54,13 @@ def run_subprocess():
|
|
54 |
line = process.readline().strip() # Read output from the subprocess
|
55 |
if line: # If there's output, append it to the list
|
56 |
output.append(line)
|
57 |
-
yield "\n".join(output) #
|
58 |
except pexpect.EOF:
|
59 |
break # End of file means the process has finished
|
60 |
|
61 |
-
return read_output
|
|
|
|
|
62 |
|
63 |
def send_input(user_input):
|
64 |
global process
|
@@ -96,10 +98,14 @@ with gr.Blocks() as gui:
|
|
96 |
# Function to update status with subprocess output
|
97 |
def update_status(ebook_input):
|
98 |
output_generator = process_ebook(ebook_input) # Pass the file to process_ebook
|
|
|
|
|
99 |
for output in output_generator:
|
100 |
status_output.value = output
|
101 |
|
102 |
|
|
|
|
|
103 |
# Start processing and update status in real-time
|
104 |
process_button.click(update_status, inputs=ebook_input, outputs=status_output)
|
105 |
|
|
|
54 |
line = process.readline().strip() # Read output from the subprocess
|
55 |
if line: # If there's output, append it to the list
|
56 |
output.append(line)
|
57 |
+
yield "\n".join(output) # Yield current output to display
|
58 |
except pexpect.EOF:
|
59 |
break # End of file means the process has finished
|
60 |
|
61 |
+
return read_output() # Call read_output() to return the actual generator
|
62 |
+
|
63 |
+
|
64 |
|
65 |
def send_input(user_input):
|
66 |
global process
|
|
|
98 |
# Function to update status with subprocess output
|
99 |
def update_status(ebook_input):
|
100 |
output_generator = process_ebook(ebook_input) # Pass the file to process_ebook
|
101 |
+
|
102 |
+
# Iterate through the generator and update status
|
103 |
for output in output_generator:
|
104 |
status_output.value = output
|
105 |
|
106 |
|
107 |
+
|
108 |
+
|
109 |
# Start processing and update status in real-time
|
110 |
process_button.click(update_status, inputs=ebook_input, outputs=status_output)
|
111 |
|