Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -401,9 +401,8 @@ def create_zip_of_files(file_paths):
|
|
401 |
|
402 |
# Access local files
|
403 |
def get_gradio_file_url(local_path):
|
404 |
-
"""Get the proper file URL for the public space"""
|
405 |
relative_path = os.path.relpath(local_path, os.getcwd())
|
406 |
-
return f"/
|
407 |
|
408 |
# Async generate lecture materials and audio
|
409 |
async def on_generate(api_service, api_key, serpapi_key, title, lecture_content_description, lecture_type, lecture_style, speaker_audio, num_slides):
|
@@ -1458,6 +1457,7 @@ async def study_mode_process(file, api_service, api_key):
|
|
1458 |
|
1459 |
# Gradio interface
|
1460 |
with gr.Blocks(
|
|
|
1461 |
title="Lectūra AI",
|
1462 |
css="""
|
1463 |
h1 {text-align: center; color: #fff !important;}
|
@@ -2008,12 +2008,7 @@ with gr.Blocks(
|
|
2008 |
|
2009 |
# Handle speaker selection
|
2010 |
def update_speaker_audio(speaker):
|
2011 |
-
"""Update speaker audio with proper URL handling"""
|
2012 |
logger.info(f"Speaker selection changed to: {speaker}")
|
2013 |
-
# Get the absolute path to the speaker file
|
2014 |
-
speaker_path = os.path.join(os.getcwd(), speaker)
|
2015 |
-
if os.path.exists(speaker_path):
|
2016 |
-
return get_gradio_file_url(speaker_path)
|
2017 |
return speaker
|
2018 |
|
2019 |
speaker_select.change(
|
|
|
401 |
|
402 |
# Access local files
|
403 |
def get_gradio_file_url(local_path):
|
|
|
404 |
relative_path = os.path.relpath(local_path, os.getcwd())
|
405 |
+
return f"/gradio_api/file={relative_path}"
|
406 |
|
407 |
# Async generate lecture materials and audio
|
408 |
async def on_generate(api_service, api_key, serpapi_key, title, lecture_content_description, lecture_type, lecture_style, speaker_audio, num_slides):
|
|
|
1457 |
|
1458 |
# Gradio interface
|
1459 |
with gr.Blocks(
|
1460 |
+
|
1461 |
title="Lectūra AI",
|
1462 |
css="""
|
1463 |
h1 {text-align: center; color: #fff !important;}
|
|
|
2008 |
|
2009 |
# Handle speaker selection
|
2010 |
def update_speaker_audio(speaker):
|
|
|
2011 |
logger.info(f"Speaker selection changed to: {speaker}")
|
|
|
|
|
|
|
|
|
2012 |
return speaker
|
2013 |
|
2014 |
speaker_select.change(
|