futranbg commited on
Commit
ff26b87
1 Parent(s): e761cd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  import gradio as gr
3
  from langchain.llms import HuggingFaceHub
4
 
@@ -77,7 +78,8 @@ def translation(source, target, text):
77
  response += stchunk
78
  except Exception as e:
79
  print(f"ERROR: LLM show {e}")
 
80
  if response == "": response = text
81
- return response.replace("<newline>","\n")
82
 
83
  gr.Interface(translation, inputs=["text","text","text"], outputs="text").launch()
 
1
  import os
2
+ import time
3
  import gradio as gr
4
  from langchain.llms import HuggingFaceHub
5
 
 
78
  response += stchunk
79
  except Exception as e:
80
  print(f"ERROR: LLM show {e}")
81
+ time.sleep(5)
82
  if response == "": response = text
83
+ return response.replace("<newline>","\n").strip()
84
 
85
  gr.Interface(translation, inputs=["text","text","text"], outputs="text").launch()