Spaces:
Runtime error
Runtime error
Added app file
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
model = pipeline("question-answering", model="/home/user/app/MendoBERT/", tokenizer="indolem/indobert-base-uncased")
|
5 |
+
basemodel = pipeline("question-answering", model="/home/user/app/IndoLEM/", tokenizer="indolem/indobert-base-uncased")
|
6 |
+
|
7 |
+
st.title(':blue[MendoBERT] - Question Answering')
|
8 |
+
|
9 |
+
if 'options' not in st.session_state:
|
10 |
+
st.session_state['options'] = ""
|
11 |
+
|
12 |
+
def button1_callback():
|
13 |
+
st.session_state['options'] = "Konteks: \n\nPertanyaan: ."
|
14 |
+
def button2_callback():
|
15 |
+
st.session_state['options'] = "Konteks: \n\nPertanyaan: ."
|
16 |
+
|
17 |
+
|
18 |
+
placeholder = st.empty()
|
19 |
+
|
20 |
+
st.caption('_Examples_')
|
21 |
+
st.button('Kami menyimpulkan bahwa polimorfisme \@GENE\$ dan AGT tidak berkontribusi pada kerentanan genetik terhadap \@DISEASE\$ dan retinopati pada populasi Kaukasia Mediterania.', use_container_width=True, on_click = button1_callback)
|
22 |
+
st.button('Genotipe bayi PON1 RR dan \@GENE\$ CC dikaitkan dengan \@DISEASE\$ dalam populasi penelitian kami, yang menunjukkan kemungkinan peran variabilitas paraoxonase manusia dalam etiologi kelahiran prematur.', use_container_width=True, on_click = button2_callback)
|
23 |
+
|
24 |
+
with placeholder:
|
25 |
+
context = st.text_area('Enter context: ', key = 'options')
|
26 |
+
question = st.text_area('Enter question: ', key = 'options')
|
27 |
+
|
28 |
+
if text:
|
29 |
+
st.subheader('MendoBERT')
|
30 |
+
st.write(model(context=context, question=question))
|
31 |
+
st.write("\n")
|
32 |
+
st.subheader('IndoLEM')
|
33 |
+
st.write(basemodel(context=context, question=question))
|