Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -401,8 +401,9 @@ def create_zip_of_files(file_paths):
|
|
| 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"/
|
| 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):
|
|
@@ -2007,7 +2008,12 @@ with gr.Blocks(
|
|
| 2007 |
|
| 2008 |
# Handle speaker selection
|
| 2009 |
def update_speaker_audio(speaker):
|
|
|
|
| 2010 |
logger.info(f"Speaker selection changed to: {speaker}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2011 |
return speaker
|
| 2012 |
|
| 2013 |
speaker_select.change(
|
|
|
|
| 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"/proxy/{relative_path}"
|
| 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):
|
|
|
|
| 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(
|