Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
app.py
CHANGED
|
@@ -345,12 +345,12 @@ def process_presentation(file_obj, password, temperature):
|
|
| 345 |
try:
|
| 346 |
# 1. Convert
|
| 347 |
print("Step 1: Converting PDF...")
|
| 348 |
-
yield ("Converting PDF...",) + EMPTY_OUTPUTS
|
| 349 |
images = convert_to_images(file_obj.name)
|
| 350 |
print(f" Converted {len(images)} slides.")
|
| 351 |
|
| 352 |
# 2. Scan (Pass 1 - Gemini Flash)
|
| 353 |
-
yield (f"Scanning {len(images)} slides...",) + EMPTY_OUTPUTS
|
| 354 |
print("Step 2: Scanning Slides (Pass 1)...")
|
| 355 |
|
| 356 |
scanner = scan_slides(scanner_client, images)
|
|
@@ -358,7 +358,7 @@ def process_presentation(file_obj, password, temperature):
|
|
| 358 |
|
| 359 |
for msg, result in scanner:
|
| 360 |
if result is None:
|
| 361 |
-
yield (msg,) + EMPTY_OUTPUTS
|
| 362 |
else:
|
| 363 |
inventory = result
|
| 364 |
|
|
@@ -380,12 +380,12 @@ def process_presentation(file_obj, password, temperature):
|
|
| 380 |
biz_persona = COACH_PERSONAS["business"]
|
| 381 |
ana_persona = COACH_PERSONAS["analytics"]
|
| 382 |
|
| 383 |
-
yield (f"💼 {biz_persona['name']} reviewing...",) + EMPTY_OUTPUTS
|
| 384 |
print(f"Step 3a: {biz_persona['name']} [Temp: {temperature}]...")
|
| 385 |
biz_critique = generate_critique(coach_client, inventory, biz_persona, temperature)
|
| 386 |
print(f" {biz_persona['name']} done.")
|
| 387 |
|
| 388 |
-
yield (f"📊 {ana_persona['name']} reviewing...",) + EMPTY_OUTPUTS
|
| 389 |
print(f"Step 3b: {ana_persona['name']} [Temp: {temperature}]...")
|
| 390 |
ana_critique = generate_critique(coach_client, inventory, ana_persona, temperature)
|
| 391 |
print(f" {ana_persona['name']} done.")
|
|
@@ -445,10 +445,10 @@ with gr.Blocks(title="Dr. Jones AI Coach",
|
|
| 445 |
pass_input = gr.Textbox(label="Password", type="password")
|
| 446 |
temp_input = gr.Slider(minimum=0.0, maximum=1.0, value=0.2, step=0.1, label="Coach Temperature")
|
| 447 |
|
| 448 |
-
btn = gr.Button("REVIEW PRESENTATION", scale=1, variant="primary")
|
| 449 |
-
|
| 450 |
status = gr.Markdown("**Status**: Ready")
|
| 451 |
|
|
|
|
|
|
|
| 452 |
with gr.Row():
|
| 453 |
with gr.Column(scale=1):
|
| 454 |
preview_img = gr.Image(label="Title Slide", interactive=False)
|
|
|
|
| 345 |
try:
|
| 346 |
# 1. Convert
|
| 347 |
print("Step 1: Converting PDF...")
|
| 348 |
+
yield ("⏳ **Converting PDF to images...**",) + EMPTY_OUTPUTS
|
| 349 |
images = convert_to_images(file_obj.name)
|
| 350 |
print(f" Converted {len(images)} slides.")
|
| 351 |
|
| 352 |
# 2. Scan (Pass 1 - Gemini Flash)
|
| 353 |
+
yield (f"⏳ **Scanning {len(images)} slides...**",) + EMPTY_OUTPUTS
|
| 354 |
print("Step 2: Scanning Slides (Pass 1)...")
|
| 355 |
|
| 356 |
scanner = scan_slides(scanner_client, images)
|
|
|
|
| 358 |
|
| 359 |
for msg, result in scanner:
|
| 360 |
if result is None:
|
| 361 |
+
yield (f"⏳ **{msg}**",) + EMPTY_OUTPUTS
|
| 362 |
else:
|
| 363 |
inventory = result
|
| 364 |
|
|
|
|
| 380 |
biz_persona = COACH_PERSONAS["business"]
|
| 381 |
ana_persona = COACH_PERSONAS["analytics"]
|
| 382 |
|
| 383 |
+
yield (f"⏳ **💼 {biz_persona['name']} reviewing...**",) + EMPTY_OUTPUTS
|
| 384 |
print(f"Step 3a: {biz_persona['name']} [Temp: {temperature}]...")
|
| 385 |
biz_critique = generate_critique(coach_client, inventory, biz_persona, temperature)
|
| 386 |
print(f" {biz_persona['name']} done.")
|
| 387 |
|
| 388 |
+
yield (f"⏳ **📊 {ana_persona['name']} reviewing...**",) + EMPTY_OUTPUTS
|
| 389 |
print(f"Step 3b: {ana_persona['name']} [Temp: {temperature}]...")
|
| 390 |
ana_critique = generate_critique(coach_client, inventory, ana_persona, temperature)
|
| 391 |
print(f" {ana_persona['name']} done.")
|
|
|
|
| 445 |
pass_input = gr.Textbox(label="Password", type="password")
|
| 446 |
temp_input = gr.Slider(minimum=0.0, maximum=1.0, value=0.2, step=0.1, label="Coach Temperature")
|
| 447 |
|
|
|
|
|
|
|
| 448 |
status = gr.Markdown("**Status**: Ready")
|
| 449 |
|
| 450 |
+
btn = gr.Button("REVIEW PRESENTATION", scale=1, variant="primary")
|
| 451 |
+
|
| 452 |
with gr.Row():
|
| 453 |
with gr.Column(scale=1):
|
| 454 |
preview_img = gr.Image(label="Title Slide", interactive=False)
|