Spaces:
Runtime error
Runtime error
Commit
·
3317827
1
Parent(s):
cc58543
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,4 @@
|
|
| 1 |
-
# %% [markdown]
|
| 2 |
-
# # AI-Translator
|
| 3 |
-
# This is an web app with an English/Chinese translation and grammar check function
|
| 4 |
|
| 5 |
-
# %% [markdown]
|
| 6 |
-
# import depandancies
|
| 7 |
-
|
| 8 |
-
# %%
|
| 9 |
from gramformer import Gramformer
|
| 10 |
import spacy
|
| 11 |
import gradio as gr
|
|
@@ -14,10 +7,7 @@ from gramformer import Gramformer
|
|
| 14 |
spacy.load('en_core_web_sm')
|
| 15 |
from spacy.lang.en import English
|
| 16 |
|
| 17 |
-
# %% [markdown]
|
| 18 |
-
# define api for translation and grama check
|
| 19 |
|
| 20 |
-
# %%
|
| 21 |
def extract_str(text):
|
| 22 |
text=str(text)
|
| 23 |
start = text.find("{'")
|
|
@@ -43,10 +33,6 @@ def generator(from_text):
|
|
| 43 |
english_text = english_generator(from_text)[0]["generated_text"]
|
| 44 |
return english_text
|
| 45 |
|
| 46 |
-
# %% [markdown]
|
| 47 |
-
# build interface for web app
|
| 48 |
-
|
| 49 |
-
# %%
|
| 50 |
|
| 51 |
with gr.Blocks() as demo:
|
| 52 |
with gr.Tab("Translator"):
|
|
@@ -94,7 +80,5 @@ with gr.Blocks() as demo:
|
|
| 94 |
demo.launch()
|
| 95 |
|
| 96 |
|
| 97 |
-
# %%
|
| 98 |
-
|
| 99 |
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from gramformer import Gramformer
|
| 3 |
import spacy
|
| 4 |
import gradio as gr
|
|
|
|
| 7 |
spacy.load('en_core_web_sm')
|
| 8 |
from spacy.lang.en import English
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
|
|
|
| 11 |
def extract_str(text):
|
| 12 |
text=str(text)
|
| 13 |
start = text.find("{'")
|
|
|
|
| 33 |
english_text = english_generator(from_text)[0]["generated_text"]
|
| 34 |
return english_text
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
with gr.Blocks() as demo:
|
| 38 |
with gr.Tab("Translator"):
|
|
|
|
| 80 |
demo.launch()
|
| 81 |
|
| 82 |
|
|
|
|
|
|
|
| 83 |
|
| 84 |
|