pinyuchen commited on
Commit
3c768ef
·
verified ·
1 Parent(s): 7569f44

DivEye - PR (fix concurrency) (#7)

Browse files

- queuing (d970af22fd1ef97b8abbc1ea6b070c8c3a8c01d1)

Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -15,7 +15,8 @@ def warmup():
15
  def detect_ai_text(text):
16
  global software
17
  if software is None:
18
- return "❗ Models not loaded yet. Please wait for a few moments.", 0.0, pd.DataFrame({
 
19
  "Source": ["AI Generated", "Human Written"],
20
  "Probability (%)": [0, 0]
21
  })
@@ -51,7 +52,6 @@ def detect_ai_text(text):
51
 
52
  # Gradio app setup
53
  with gr.Blocks(title="DivEye", theme=theme) as demo:
54
- demo.on_start(warmup)
55
  gr.HTML("""
56
  <div style="display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; background: #f0f4f8; border-radius: 12px; margin-bottom: 1rem;">
57
  <div style="text-align: left; max-width: 70%;">
@@ -144,4 +144,5 @@ with gr.Blocks(title="DivEye", theme=theme) as demo:
144
 
145
  # Run the app
146
  if __name__ == "__main__":
 
147
  demo.launch()
 
15
  def detect_ai_text(text):
16
  global software
17
  if software is None:
18
+ warmup()
19
+ return "⏳ Models not loaded yet. Please wait for a few moments.", 0.0, pd.DataFrame({
20
  "Source": ["AI Generated", "Human Written"],
21
  "Probability (%)": [0, 0]
22
  })
 
52
 
53
  # Gradio app setup
54
  with gr.Blocks(title="DivEye", theme=theme) as demo:
 
55
  gr.HTML("""
56
  <div style="display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; background: #f0f4f8; border-radius: 12px; margin-bottom: 1rem;">
57
  <div style="text-align: left; max-width: 70%;">
 
144
 
145
  # Run the app
146
  if __name__ == "__main__":
147
+ demo.queue()
148
  demo.launch()