T-K-O-H commited on
Commit
7b4d1c6
·
1 Parent(s): 779c2f3

huggingface problem 1

Browse files
Files changed (1) hide show
  1. app.py +34 -7
app.py CHANGED
@@ -1342,16 +1342,41 @@ def create_ui():
1342
  research_loading,
1343
  improved_loading
1344
  ],
1345
- show_progress=False
 
1346
  )
1347
 
1348
- # Update error visibility
1349
  error.change(
1350
- lambda x: gr.update(visible=bool(x)),
1351
  error,
1352
- error
 
1353
  )
1354
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1355
  return demo
1356
 
1357
  def print_graph():
@@ -1710,9 +1735,11 @@ Important:
1710
  if __name__ == "__main__":
1711
  print_graph() # Print the graph visualization
1712
  demo = create_ui()
 
1713
  demo.launch(
1714
- server_name="0.0.0.0",
1715
- server_port=None, # Let Gradio find an available port
 
1716
  show_error=True,
1717
  share=True,
1718
  show_api=False
 
1342
  research_loading,
1343
  improved_loading
1344
  ],
1345
+ show_progress=True, # Show progress bar
1346
+ api_name="convert" # Name the API endpoint
1347
  )
1348
 
1349
+ # Update error visibility with immediate feedback
1350
  error.change(
1351
+ lambda x: gr.update(visible=bool(x), value=x), # Update both visibility and value
1352
  error,
1353
+ error,
1354
+ queue=False # Process immediately
1355
  )
1356
+
1357
+ # Add loading state visibility updates
1358
+ def update_loading_visibility(is_loading):
1359
+ return {
1360
+ loading: gr.update(visible=is_loading)
1361
+ for loading in [
1362
+ transcript_loading,
1363
+ enhanced_loading,
1364
+ linkedin_loading,
1365
+ verify_loading,
1366
+ plan_loading,
1367
+ research_loading,
1368
+ improved_loading
1369
+ ]
1370
+ }
1371
+
1372
+ youtube_convert_btn.click(
1373
+ lambda: update_loading_visibility(True),
1374
+ None,
1375
+ [transcript_loading, enhanced_loading, linkedin_loading,
1376
+ verify_loading, plan_loading, research_loading, improved_loading],
1377
+ queue=False
1378
+ )
1379
+
1380
  return demo
1381
 
1382
  def print_graph():
 
1735
  if __name__ == "__main__":
1736
  print_graph() # Print the graph visualization
1737
  demo = create_ui()
1738
+ demo.queue() # Enable queuing for better handling of concurrent requests
1739
  demo.launch(
1740
+ server_name="0.0.0.0", # Required for Hugging Face Spaces
1741
+ server_port=7860, # Standard port for Hugging Face Spaces
1742
+ share=False, # Disable sharing as it's not needed on Spaces
1743
  show_error=True,
1744
  share=True,
1745
  show_api=False