Spaces:
Running
Running
Upload 4 files
Browse files- app/webui/README.md +7 -0
- app/webui/app.py +2 -2
- app/webui/process.py +1 -1
app/webui/README.md
CHANGED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Tranlsation-Agent-Webui
|
2 |
+
|
3 |
+
## Usage
|
4 |
+
|
5 |
+
git clone https://github.com/andrewyng/translation-agent.git
|
6 |
+
cd translation-agent\app\webui
|
7 |
+
pip install -
|
app/webui/app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import re
|
2 |
import gradio as gr
|
3 |
-
from process import model_load, lang_detector, diff_texts, translator, read_doc
|
4 |
from llama_index.core import SimpleDirectoryReader
|
5 |
|
6 |
def huanik(
|
@@ -142,6 +142,6 @@ with gr.Blocks(theme="soft", css=CSS) as demo:
|
|
142 |
source_text.change(lang_detector, source_text, source_lang)
|
143 |
submit.click(fn=huanik, inputs=[endpoint, model, api_key, source_lang, target_lang, source_text, country, max_tokens, context_window, num_output], outputs=[output_init, output_reflect, output_final, output_diff])
|
144 |
upload.upload(fn=read_doc, inputs = upload, outputs = source_text)
|
145 |
-
|
146 |
if __name__ == "__main__":
|
147 |
demo.queue(api_open=False).launch(show_api=False, share=False)
|
|
|
1 |
import re
|
2 |
import gradio as gr
|
3 |
+
from app.webui.process import model_load, lang_detector, diff_texts, translator, read_doc
|
4 |
from llama_index.core import SimpleDirectoryReader
|
5 |
|
6 |
def huanik(
|
|
|
142 |
source_text.change(lang_detector, source_text, source_lang)
|
143 |
submit.click(fn=huanik, inputs=[endpoint, model, api_key, source_lang, target_lang, source_text, country, max_tokens, context_window, num_output], outputs=[output_init, output_reflect, output_final, output_diff])
|
144 |
upload.upload(fn=read_doc, inputs = upload, outputs = source_text)
|
145 |
+
|
146 |
if __name__ == "__main__":
|
147 |
demo.queue(api_open=False).launch(show_api=False, share=False)
|
app/webui/process.py
CHANGED
@@ -2,7 +2,7 @@ from polyglot.detect import Detector
|
|
2 |
from polyglot.text import Text
|
3 |
from difflib import Differ
|
4 |
from icecream import ic
|
5 |
-
from patch import *
|
6 |
from llama_index.core.node_parser import SentenceSplitter
|
7 |
|
8 |
def lang_detector(text):
|
|
|
2 |
from polyglot.text import Text
|
3 |
from difflib import Differ
|
4 |
from icecream import ic
|
5 |
+
from app.webui.patch import *
|
6 |
from llama_index.core.node_parser import SentenceSplitter
|
7 |
|
8 |
def lang_detector(text):
|