Upload 5 files
Browse files- .streamlit/config.toml +3 -0
- Demo.py +124 -0
- Dockerfile +72 -0
- pages/Workflow & Model Overview.py +174 -0
- requirements.txt +7 -0
.streamlit/config.toml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
[theme]
|
2 |
+
base="light"
|
3 |
+
primaryColor="#29B4E8"
|
Demo.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import sparknlp
|
3 |
+
|
4 |
+
from sparknlp.base import *
|
5 |
+
from sparknlp.annotator import *
|
6 |
+
from pyspark.ml import Pipeline
|
7 |
+
|
8 |
+
# Page configuration
|
9 |
+
st.set_page_config(
|
10 |
+
layout="wide",
|
11 |
+
initial_sidebar_state="auto"
|
12 |
+
)
|
13 |
+
|
14 |
+
# CSS for styling
|
15 |
+
st.markdown("""
|
16 |
+
<style>
|
17 |
+
.main-title {
|
18 |
+
font-size: 36px;
|
19 |
+
color: #4A90E2;
|
20 |
+
font-weight: bold;
|
21 |
+
text-align: center;
|
22 |
+
}
|
23 |
+
.section {
|
24 |
+
background-color: #f9f9f9;
|
25 |
+
padding: 10px;
|
26 |
+
border-radius: 10px;
|
27 |
+
margin-top: 10px;
|
28 |
+
}
|
29 |
+
.section p, .section ul {
|
30 |
+
color: #666666;
|
31 |
+
}
|
32 |
+
</style>
|
33 |
+
""", unsafe_allow_html=True)
|
34 |
+
|
35 |
+
@st.cache_resource
|
36 |
+
def init_spark():
|
37 |
+
return sparknlp.start()
|
38 |
+
|
39 |
+
@st.cache_resource
|
40 |
+
def create_pipeline():
|
41 |
+
document_assembler = MultiDocumentAssembler()\
|
42 |
+
.setInputCols(["question", "context"]) \
|
43 |
+
.setOutputCols(["document_question", "document_context"])
|
44 |
+
|
45 |
+
quesAnswer = XlmRoBertaForQuestionAnswering.pretrained("xlm_roberta_base_qa_squad2","en") \
|
46 |
+
.setInputCols(["document_question","document_context"]) \
|
47 |
+
.setOutputCol("answer")
|
48 |
+
|
49 |
+
pipeline = Pipeline(stages=[document_assembler, quesAnswer])
|
50 |
+
return pipeline
|
51 |
+
|
52 |
+
def fit_data(pipeline, ques='', cont=''):
|
53 |
+
df = spark.createDataFrame([[ques, cont]]).toDF("question", "context")
|
54 |
+
result = pipeline.fit(df).transform(df)
|
55 |
+
return result.select('answer.result').collect()
|
56 |
+
|
57 |
+
tasks_models_descriptions = {
|
58 |
+
"Question Answering": {
|
59 |
+
"models": ["xlm_roberta_base_qa_squad2"],
|
60 |
+
"description": "The 'xlm_roberta_base_qa_squad2' model, based on RoBERTa, is designed for precise question answering. They excel in extracting answers from a given context, making them suitable for developing advanced QA systems, enhancing customer support, and retrieving specific information from text."
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
# Sidebar content
|
65 |
+
task = 'Question Answering'
|
66 |
+
model = st.sidebar.selectbox("Choose the pretrained model", tasks_models_descriptions[task]["models"], help="For more info about the models visit: https://sparknlp.org/models")
|
67 |
+
|
68 |
+
# Reference notebook link in sidebar
|
69 |
+
link = """
|
70 |
+
<a href="https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/357691d18373d6e8f13b5b1015137a398fd0a45f/Spark_NLP_Udemy_MOOC/Open_Source/17.01.Transformers-based_Embeddings.ipynb#L103">
|
71 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg" style="zoom: 1.3" alt="Open In Colab"/>
|
72 |
+
</a>
|
73 |
+
"""
|
74 |
+
st.sidebar.markdown('Reference notebook:')
|
75 |
+
st.sidebar.markdown(link, unsafe_allow_html=True)
|
76 |
+
|
77 |
+
# Page content
|
78 |
+
title, sub_title = (f'DeBERTa for {task}', tasks_models_descriptions[task]["description"])
|
79 |
+
st.markdown(f'<div class="main-title">{title}</div>', unsafe_allow_html=True)
|
80 |
+
container = st.container(border=True)
|
81 |
+
container.write(sub_title)
|
82 |
+
|
83 |
+
# Load examples
|
84 |
+
examples_mapping = {
|
85 |
+
"Question Answering": {
|
86 |
+
"""What does increased oxygen concentrations in the patient’s lungs displace?""": """Hyperbaric (high-pressure) medicine uses special oxygen chambers to increase the partial pressure of O 2 around the patient and, when needed, the medical staff. Carbon monoxide poisoning, gas gangrene, and decompression sickness (the ’bends’) are sometimes treated using these devices. Increased O 2 concentration in the lungs helps to displace carbon monoxide from the heme group of hemoglobin. Oxygen gas is poisonous to the anaerobic bacteria that cause gas gangrene, so increasing its partial pressure helps kill them. Decompression sickness occurs in divers who decompress too quickly after a dive, resulting in bubbles of inert gas, mostly nitrogen and helium, forming in their blood. Increasing the pressure of O 2 as soon as possible is part of the treatment.""",
|
87 |
+
"""What category of game is Legend of Zelda: Twilight Princess?""": """The Legend of Zelda: Twilight Princess (Japanese: ゼルダの伝説 トワイライトプリンセス, Hepburn: Zeruda no Densetsu: Towairaito Purinsesu?) is an action-adventure game developed and published by Nintendo for the GameCube and Wii home video game consoles. It is the thirteenth installment in the The Legend of Zelda series. Originally planned for release on the GameCube in November 2005, Twilight Princess was delayed by Nintendo to allow its developers to refine the game, add more content, and port it to the Wii. The Wii version was released alongside the console in North America in November 2006, and in Japan, Europe, and Australia the following month. The GameCube version was released worldwide in December 2006.""",
|
88 |
+
"""Who is founder of Alibaba Group?""": """Alibaba Group founder Jack Ma has made his first appearance since Chinese regulators cracked down on his business empire. His absence had fuelled speculation over his whereabouts amid increasing official scrutiny of his businesses. The billionaire met 100 rural teachers in China via a video meeting on Wednesday, according to local government media. Alibaba shares surged 5% on Hong Kong's stock exchange on the news.""",
|
89 |
+
"""For what instrument did Frédéric write primarily for?""": """Frédéric François Chopin (/ˈʃoʊpæn/; French pronunciation: [fʁe.de.ʁik fʁɑ̃.swa ʃɔ.pɛ̃]; 22 February or 1 March 1810 – 17 October 1849), born Fryderyk Franciszek Chopin,[n 1] was a Polish and French (by citizenship and birth of father) composer and a virtuoso pianist of the Romantic era, who wrote primarily for the solo piano. He gained and has maintained renown worldwide as one of the leading musicians of his era, whose "poetic genius was based on a professional technique that was without equal in his generation." Chopin was born in what was then the Duchy of Warsaw, and grew up in Warsaw, which after 1815 became part of Congress Poland. A child prodigy, he completed his musical education and composed his earlier works in Warsaw before leaving Poland at the age of 20, less than a month before the outbreak of the November 1830 Uprising.""",
|
90 |
+
"""The most populated city in the United States is which city?""": """New York—often called New York City or the City of New York to distinguish it from the State of New York, of which it is a part—is the most populous city in the United States and the center of the New York metropolitan area, the premier gateway for legal immigration to the United States and one of the most populous urban agglomerations in the world. A global power city, New York exerts a significant impact upon commerce, finance, media, art, fashion, research, technology, education, and entertainment, its fast pace defining the term New York minute. Home to the headquarters of the United Nations, New York is an important center for international diplomacy and has been described as the cultural and financial capital of the world."""
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
examples = list(examples_mapping[task].keys())
|
95 |
+
selected_text = st.selectbox('Select an Example:', examples)
|
96 |
+
st.subheader('Try it yourself!')
|
97 |
+
custom_input_question = st.text_input('Create a question')
|
98 |
+
custom_input_context = st.text_input("Create it's context")
|
99 |
+
|
100 |
+
custom_examples = {}
|
101 |
+
|
102 |
+
st.subheader('Selected Text')
|
103 |
+
|
104 |
+
if custom_input_question and custom_input_context:
|
105 |
+
QUESTION = custom_input_question
|
106 |
+
CONTEXT = custom_input_context
|
107 |
+
elif selected_text:
|
108 |
+
QUESTION = selected_text
|
109 |
+
CONTEXT = examples_mapping[task][selected_text]
|
110 |
+
|
111 |
+
st.markdown(f"**Question:** {QUESTION}")
|
112 |
+
st.markdown(f"**Context:** {CONTEXT}")
|
113 |
+
|
114 |
+
# Initialize Spark and create pipeline
|
115 |
+
spark = init_spark()
|
116 |
+
pipeline = create_pipeline()
|
117 |
+
output = fit_data(pipeline, QUESTION, CONTEXT)
|
118 |
+
|
119 |
+
# Display matched sentence
|
120 |
+
st.subheader("Prediction:")
|
121 |
+
|
122 |
+
output_text = "".join(output[0][0])
|
123 |
+
st.markdown(f"Answer: **{output_text}**")
|
124 |
+
|
Dockerfile
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Download base image ubuntu 18.04
|
2 |
+
FROM ubuntu:18.04
|
3 |
+
|
4 |
+
# Set environment variables
|
5 |
+
ENV NB_USER jovyan
|
6 |
+
ENV NB_UID 1000
|
7 |
+
ENV HOME /home/${NB_USER}
|
8 |
+
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
|
9 |
+
|
10 |
+
# Install required packages
|
11 |
+
RUN apt-get update && apt-get install -y \
|
12 |
+
tar \
|
13 |
+
wget \
|
14 |
+
bash \
|
15 |
+
rsync \
|
16 |
+
gcc \
|
17 |
+
libfreetype6-dev \
|
18 |
+
libhdf5-serial-dev \
|
19 |
+
libpng-dev \
|
20 |
+
libzmq3-dev \
|
21 |
+
python3 \
|
22 |
+
python3-dev \
|
23 |
+
python3-pip \
|
24 |
+
unzip \
|
25 |
+
pkg-config \
|
26 |
+
software-properties-common \
|
27 |
+
graphviz \
|
28 |
+
openjdk-8-jdk \
|
29 |
+
ant \
|
30 |
+
ca-certificates-java \
|
31 |
+
&& apt-get clean \
|
32 |
+
&& update-ca-certificates -f
|
33 |
+
|
34 |
+
# Install Python 3.8 and pip
|
35 |
+
RUN add-apt-repository ppa:deadsnakes/ppa \
|
36 |
+
&& apt-get update \
|
37 |
+
&& apt-get install -y python3.8 python3-pip \
|
38 |
+
&& apt-get clean
|
39 |
+
|
40 |
+
# Set up JAVA_HOME
|
41 |
+
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/" >> /etc/profile \
|
42 |
+
&& echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile
|
43 |
+
# Create a new user named "jovyan" with user ID 1000
|
44 |
+
RUN useradd -m -u ${NB_UID} ${NB_USER}
|
45 |
+
|
46 |
+
# Switch to the "jovyan" user
|
47 |
+
USER ${NB_USER}
|
48 |
+
|
49 |
+
# Set home and path variables for the user
|
50 |
+
ENV HOME=/home/${NB_USER} \
|
51 |
+
PATH=/home/${NB_USER}/.local/bin:$PATH
|
52 |
+
|
53 |
+
# Set up PySpark to use Python 3.8 for both driver and workers
|
54 |
+
ENV PYSPARK_PYTHON=/usr/bin/python3.8
|
55 |
+
ENV PYSPARK_DRIVER_PYTHON=/usr/bin/python3.8
|
56 |
+
|
57 |
+
# Set the working directory to the user's home directory
|
58 |
+
WORKDIR ${HOME}
|
59 |
+
|
60 |
+
# Upgrade pip and install Python dependencies
|
61 |
+
RUN python3.8 -m pip install --upgrade pip
|
62 |
+
COPY requirements.txt /tmp/requirements.txt
|
63 |
+
RUN python3.8 -m pip install -r /tmp/requirements.txt
|
64 |
+
|
65 |
+
# Copy the application code into the container at /home/jovyan
|
66 |
+
COPY --chown=${NB_USER}:${NB_USER} . ${HOME}
|
67 |
+
|
68 |
+
# Expose port for Streamlit
|
69 |
+
EXPOSE 7860
|
70 |
+
|
71 |
+
# Define the entry point for the container
|
72 |
+
ENTRYPOINT ["streamlit", "run", "Demo.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
pages/Workflow & Model Overview.py
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
# Page configuration
|
4 |
+
st.set_page_config(
|
5 |
+
layout="wide",
|
6 |
+
initial_sidebar_state="auto"
|
7 |
+
)
|
8 |
+
|
9 |
+
# Custom CSS for better styling
|
10 |
+
st.markdown("""
|
11 |
+
<style>
|
12 |
+
.main-title {
|
13 |
+
font-size: 36px;
|
14 |
+
color: #4A90E2;
|
15 |
+
font-weight: bold;
|
16 |
+
text-align: center;
|
17 |
+
}
|
18 |
+
.sub-title {
|
19 |
+
font-size: 24px;
|
20 |
+
color: #4A90E2;
|
21 |
+
margin-top: 20px;
|
22 |
+
}
|
23 |
+
.section {
|
24 |
+
background-color: #f9f9f9;
|
25 |
+
padding: 15px;
|
26 |
+
border-radius: 10px;
|
27 |
+
margin-top: 20px;
|
28 |
+
}
|
29 |
+
.section h2 {
|
30 |
+
font-size: 22px;
|
31 |
+
color: #4A90E2;
|
32 |
+
}
|
33 |
+
.section p, .section ul {
|
34 |
+
color: #666666;
|
35 |
+
}
|
36 |
+
.link {
|
37 |
+
color: #4A90E2;
|
38 |
+
text-decoration: none;
|
39 |
+
}
|
40 |
+
.benchmark-table {
|
41 |
+
width: 100%;
|
42 |
+
border-collapse: collapse;
|
43 |
+
margin-top: 20px;
|
44 |
+
}
|
45 |
+
.benchmark-table th, .benchmark-table td {
|
46 |
+
border: 1px solid #ddd;
|
47 |
+
padding: 8px;
|
48 |
+
text-align: left;
|
49 |
+
}
|
50 |
+
.benchmark-table th {
|
51 |
+
background-color: #4A90E2;
|
52 |
+
color: white;
|
53 |
+
}
|
54 |
+
.benchmark-table td {
|
55 |
+
background-color: #f2f2f2;
|
56 |
+
}
|
57 |
+
</style>
|
58 |
+
""", unsafe_allow_html=True)
|
59 |
+
|
60 |
+
# Title
|
61 |
+
st.markdown('<div class="main-title">Introduction to XLM-RoBERTa Annotators in Spark NLP</div>', unsafe_allow_html=True)
|
62 |
+
|
63 |
+
# Subtitle
|
64 |
+
st.markdown("""
|
65 |
+
<div class="section">
|
66 |
+
<p>XLM-RoBERTa (Cross-lingual Robustly Optimized BERT Approach) is an advanced multilingual model that extends the capabilities of RoBERTa to over 100 languages. Pre-trained on a massive, diverse corpus, XLM-RoBERTa is designed to handle various NLP tasks in a multilingual context, making it ideal for applications that require cross-lingual understanding. Below, we provide an overview of the XLM-RoBERTa annotators for these tasks:</p>
|
67 |
+
</div>
|
68 |
+
""", unsafe_allow_html=True)
|
69 |
+
|
70 |
+
# XLM-RoBERTa for Question Answering
|
71 |
+
st.markdown("""<div class="sub-title">Question Answering with XLM-RoBERTa</div>""", unsafe_allow_html=True)
|
72 |
+
st.markdown("""
|
73 |
+
<div class="section">
|
74 |
+
<p>Question answering (QA) is a crucial task in Natural Language Processing (NLP) where the goal is to extract an answer from a given context in response to a specific question.</p>
|
75 |
+
<p><strong>XLM-RoBERTa</strong> excels in question answering tasks across multiple languages, making it an invaluable tool for global applications. Below is an example of how to implement question answering using XLM-RoBERTa in Spark NLP.</p>
|
76 |
+
<p>Using XLM-RoBERTa for Question Answering enables:</p>
|
77 |
+
<ul>
|
78 |
+
<li><strong>Multilingual QA:</strong> Extract answers from text in various languages with a single model.</li>
|
79 |
+
<li><strong>Accurate Contextual Understanding:</strong> Leverage XLM-RoBERTa's deep understanding of context to provide precise answers.</li>
|
80 |
+
<li><strong>Cross-Domain Flexibility:</strong> Apply to different domains, from customer support to education, across languages.</li>
|
81 |
+
</ul>
|
82 |
+
<p>Advantages of using XLM-RoBERTa for Question Answering in Spark NLP include:</p>
|
83 |
+
<ul>
|
84 |
+
<li><strong>Scalability:</strong> Spark NLP is built on Apache Spark, ensuring efficient scaling for large datasets.</li>
|
85 |
+
<li><strong>Pretrained Excellence:</strong> Utilize state-of-the-art pretrained models to achieve high accuracy in question answering tasks.</li>
|
86 |
+
<li><strong>Multilingual Flexibility:</strong> XLM-RoBERTa’s multilingual capabilities make it suitable for global applications, reducing the need for language-specific models.</li>
|
87 |
+
<li><strong>Seamless Integration:</strong> Easily incorporate XLM-RoBERTa into your existing Spark pipelines for streamlined NLP workflows.</li>
|
88 |
+
</ul>
|
89 |
+
</div>
|
90 |
+
""", unsafe_allow_html=True)
|
91 |
+
|
92 |
+
st.markdown("""<div class="sub-title">How to Use XLM-RoBERTa for Question Answering in Spark NLP</div>""", unsafe_allow_html=True)
|
93 |
+
st.markdown("""
|
94 |
+
<div class="section">
|
95 |
+
<p>To leverage XLM-RoBERTa for question answering, Spark NLP provides a user-friendly pipeline setup. The following example shows how to use XLM-RoBERTa for extracting answers from a given context based on a specific question. XLM-RoBERTa’s multilingual training enables it to perform question answering across various languages, making it an essential tool for global NLP tasks.</p>
|
96 |
+
</div>
|
97 |
+
""", unsafe_allow_html=True)
|
98 |
+
|
99 |
+
# Code Example
|
100 |
+
st.code('''
|
101 |
+
from sparknlp.base import *
|
102 |
+
from sparknlp.annotator import *
|
103 |
+
from pyspark.ml import Pipeline
|
104 |
+
|
105 |
+
document_assembler = MultiDocumentAssembler() \\
|
106 |
+
.setInputCols(["question", "context"]) \\
|
107 |
+
.setOutputCols(["document_question", "document_context"])
|
108 |
+
|
109 |
+
spanClassifier = XlmRoBertaForQuestionAnswering.pretrained("xlm_roberta_qa_Part_1_XLM_Model_E1","en") \\
|
110 |
+
.setInputCols(["document_question", "document_context"]) \\
|
111 |
+
.setOutputCol("answer") \\
|
112 |
+
.setCaseSensitive(True)
|
113 |
+
|
114 |
+
pipeline = Pipeline().setStages([document_assembler, spanClassifier])
|
115 |
+
|
116 |
+
example = spark.createDataFrame([["What's my name?", "My name is Clara and I live in Berkeley."]]).toDF("question", "context")
|
117 |
+
|
118 |
+
result = pipeline.fit(example).transform(example)
|
119 |
+
result.select("answer.result").show(truncate=False)
|
120 |
+
''', language='python')
|
121 |
+
|
122 |
+
st.text("""
|
123 |
+
+-----------+
|
124 |
+
| result |
|
125 |
+
+-----------+
|
126 |
+
|[Clara] |
|
127 |
+
+-----------+
|
128 |
+
""")
|
129 |
+
|
130 |
+
# Model Info Section
|
131 |
+
st.markdown('<div class="sub-title">Choosing the Right Model</div>', unsafe_allow_html=True)
|
132 |
+
st.markdown("""
|
133 |
+
<div class="section">
|
134 |
+
<p>The XLM-RoBERTa model used here is pretrained and fine-tuned for question answering tasks, providing high accuracy and multilingual support.</p>
|
135 |
+
<p>For more information about the model, visit the <a class="link" href="https://huggingface.co/xlm-roberta-base" target="_blank">XLM-RoBERTa Model Hub</a>.</p>
|
136 |
+
</div>
|
137 |
+
""", unsafe_allow_html=True)
|
138 |
+
|
139 |
+
# References Section
|
140 |
+
st.markdown('<div class="sub-title">References</div>', unsafe_allow_html=True)
|
141 |
+
st.markdown("""
|
142 |
+
<div class="section">
|
143 |
+
<ul>
|
144 |
+
<li><a class="link" href="https://arxiv.org/abs/1911.02116" target="_blank">XLM-R: Cross-lingual Pre-training</a></li>
|
145 |
+
<li><a class="link" href="https://huggingface.co/xlm-roberta-base" target="_blank">XLM-RoBERTa Model Overview</a></li>
|
146 |
+
</ul>
|
147 |
+
</div>
|
148 |
+
""", unsafe_allow_html=True)
|
149 |
+
|
150 |
+
# Footer
|
151 |
+
st.markdown("""
|
152 |
+
<div class="section">
|
153 |
+
<ul>
|
154 |
+
<li><a class="link" href="https://sparknlp.org/" target="_blank">Official Website</a>: Documentation and examples</li>
|
155 |
+
<li><a class="link" href="https://join.slack.com/t/spark-nlp/shared_invite/zt-198dipu77-L3UWNe_AJ8xqDk0ivmih5Q" target="_blank">Slack</a>: Live discussion with the community and team</li>
|
156 |
+
<li><a class="link" href="https://github.com/JohnSnowLabs/spark-nlp" target="_blank">GitHub</a>: Bug reports, feature requests, and contributions</li>
|
157 |
+
<li><a class="link" href="https://medium.com/spark-nlp" target="_blank">Medium</a>: Spark NLP articles</li>
|
158 |
+
<li><a class="link" href="https://www.youtube.com/channel/UCmFOjlpYEhxf_wJUDuz6xxQ/videos" target="_blank">YouTube</a>: Video tutorials</li>
|
159 |
+
</ul>
|
160 |
+
</div>
|
161 |
+
""", unsafe_allow_html=True)
|
162 |
+
|
163 |
+
st.markdown('<div class="sub-title">Quick Links</div>', unsafe_allow_html=True)
|
164 |
+
|
165 |
+
st.markdown("""
|
166 |
+
<div class="section">
|
167 |
+
<ul>
|
168 |
+
<li><a class="link" href="https://sparknlp.org/docs/en/quickstart" target="_blank">Getting Started</a></li>
|
169 |
+
<li><a class="link" href="https://nlp.johnsnowlabs.com/models" target="_blank">Pretrained Models</a></li>
|
170 |
+
<li><a class="link" href="https://github.com/JohnSnowLabs/spark-nlp/tree/master/examples/python/annotation/text/english" target="_blank">Example Notebooks</a></li>
|
171 |
+
<li><a class="link" href="https://sparknlp.org/docs/en/install" target="_blank">Installation Guide</a></li>
|
172 |
+
</ul>
|
173 |
+
</div>
|
174 |
+
""", unsafe_allow_html=True)
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
st-annotated-text
|
3 |
+
streamlit-tags
|
4 |
+
pandas
|
5 |
+
numpy
|
6 |
+
spark-nlp
|
7 |
+
pyspark
|