Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,14 @@
|
|
| 1 |
import os
|
| 2 |
import tarfile
|
| 3 |
-
import gdown
|
| 4 |
import spacy
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
tar_file = "xx_cv_parsing_ner.tar.gz"
|
| 10 |
extract_path = "xx_cv_parsing_ner"
|
| 11 |
|
| 12 |
-
#
|
| 13 |
if not os.path.exists(extract_path):
|
| 14 |
-
print("Mengunduh model...")
|
| 15 |
-
gdown.download(drive_url, tar_file, quiet=False)
|
| 16 |
-
|
| 17 |
-
print("Mengekstrak model...")
|
| 18 |
with tarfile.open(tar_file, "r:gz") as tar:
|
| 19 |
tar.extractall(path=extract_path)
|
| 20 |
|
|
@@ -34,9 +28,8 @@ demo = gr.Interface(
|
|
| 34 |
fn=extract_entities,
|
| 35 |
inputs=gr.Textbox(lines=15, label="Masukkan Teks CV"),
|
| 36 |
outputs=gr.Dataframe(headers=["Entity", "Label"], label="Hasil Ekstraksi"),
|
| 37 |
-
title="Ekstraksi Entitas CV"
|
| 38 |
)
|
| 39 |
|
| 40 |
-
# Jalankan
|
| 41 |
if __name__ == "__main__":
|
| 42 |
demo.launch()
|
|
|
|
| 1 |
import os
|
| 2 |
import tarfile
|
|
|
|
| 3 |
import spacy
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
+
# Nama file dan lokasi ekstraksi
|
| 7 |
+
tar_file = "xx_cv_parsing_ner-0.0.1.tar.gz"
|
|
|
|
| 8 |
extract_path = "xx_cv_parsing_ner"
|
| 9 |
|
| 10 |
+
# Ekstrak jika belum diekstrak
|
| 11 |
if not os.path.exists(extract_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
with tarfile.open(tar_file, "r:gz") as tar:
|
| 13 |
tar.extractall(path=extract_path)
|
| 14 |
|
|
|
|
| 28 |
fn=extract_entities,
|
| 29 |
inputs=gr.Textbox(lines=15, label="Masukkan Teks CV"),
|
| 30 |
outputs=gr.Dataframe(headers=["Entity", "Label"], label="Hasil Ekstraksi"),
|
| 31 |
+
title="Ekstraksi Entitas CV"
|
| 32 |
)
|
| 33 |
|
|
|
|
| 34 |
if __name__ == "__main__":
|
| 35 |
demo.launch()
|