Kuberwastaken commited on
Commit
b6fc770
·
1 Parent(s): 4db3c84
Files changed (1) hide show
  1. gradio_app.py +4 -6
gradio_app.py CHANGED
@@ -1,4 +1,3 @@
1
- # gradio_app.py
2
  import gradio as gr
3
  from model.analyzer import analyze_content
4
  import asyncio
@@ -99,9 +98,8 @@ def analyze_with_loading(text, progress=gr.Progress()):
99
  # Perform analysis
100
  progress(0.3, desc="Processing text...")
101
  try:
102
- # Run the async function in a sync context
103
- loop = asyncio.get_event_loop()
104
- result = loop.run_until_complete(analyze_content(text))
105
  except Exception as e:
106
  return f"Error during analysis: {str(e)}"
107
 
@@ -166,9 +164,9 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
166
  )
167
 
168
  if __name__ == "__main__":
169
- # Launch with custom configurations
170
  iface.launch(
171
  share=False,
172
  debug=True,
173
- show_error=True,
174
  )
 
 
1
  import gradio as gr
2
  from model.analyzer import analyze_content
3
  import asyncio
 
98
  # Perform analysis
99
  progress(0.3, desc="Processing text...")
100
  try:
101
+ # Use asyncio.run to handle the async function call
102
+ result = asyncio.run(analyze_content(text))
 
103
  except Exception as e:
104
  return f"Error during analysis: {str(e)}"
105
 
 
164
  )
165
 
166
  if __name__ == "__main__":
167
+ # Launch without the 'ssr' argument
168
  iface.launch(
169
  share=False,
170
  debug=True,
171
+ show_error=True
172
  )