Spaces:
Runtime error
Runtime error
Commit
·
8067e81
1
Parent(s):
d19ecaa
Upload app.py
Browse files
app.py
CHANGED
@@ -39,6 +39,7 @@ orange = [197/255, 90/255, 17/255]
|
|
39 |
# Pipelines definieren
|
40 |
en_de_translator = pipeline("translation_de_to_en", model='google/bert2bert_L-24_wmt_de_en')
|
41 |
qa_pipeline = pipeline("question-answering", model='deepset/gelectra-base-germanquad')
|
|
|
42 |
|
43 |
tab1, tab2, tab3, tab4 = st.tabs(
|
44 |
["Künstliche Neuronale Netze", "Wortvektoren Stimmung", "Wörter Maskieren", "Demos"])
|
@@ -367,7 +368,12 @@ with tab4:
|
|
367 |
a5 = en_de_translator(string_3)
|
368 |
st.text(a5)
|
369 |
|
|
|
370 |
st.text('')
|
|
|
|
|
|
|
|
|
371 |
text_input_4 = 'Was ist der Schwerpunkt?'
|
372 |
|
373 |
string_4 = st.text_area('Frage zum Kontext beantworten', value=text_input_4, height=25)
|
@@ -381,3 +387,30 @@ with tab4:
|
|
381 |
|
382 |
a5 = qa_pipeline(question=string_4, context=string_5)
|
383 |
st.text(a5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
# Pipelines definieren
|
40 |
en_de_translator = pipeline("translation_de_to_en", model='google/bert2bert_L-24_wmt_de_en')
|
41 |
qa_pipeline = pipeline("question-answering", model='deepset/gelectra-base-germanquad')
|
42 |
+
sentiment = pipeline("text-classification", model='oliverguhr/german-sentiment-bert')
|
43 |
|
44 |
tab1, tab2, tab3, tab4 = st.tabs(
|
45 |
["Künstliche Neuronale Netze", "Wortvektoren Stimmung", "Wörter Maskieren", "Demos"])
|
|
|
368 |
a5 = en_de_translator(string_3)
|
369 |
st.text(a5)
|
370 |
|
371 |
+
#########################################################
|
372 |
st.text('')
|
373 |
+
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """,
|
374 |
+
unsafe_allow_html=True)
|
375 |
+
st.text('')
|
376 |
+
|
377 |
text_input_4 = 'Was ist der Schwerpunkt?'
|
378 |
|
379 |
string_4 = st.text_area('Frage zum Kontext beantworten', value=text_input_4, height=25)
|
|
|
387 |
|
388 |
a5 = qa_pipeline(question=string_4, context=string_5)
|
389 |
st.text(a5)
|
390 |
+
|
391 |
+
############################################################
|
392 |
+
st.text('')
|
393 |
+
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """,
|
394 |
+
unsafe_allow_html=True)
|
395 |
+
st.text('')
|
396 |
+
|
397 |
+
text_input_7 = 'Wir lieben Data Science.?'
|
398 |
+
|
399 |
+
string_7 = st.text_area('Stimmungsanalyse', value=text_input_7, height=25)
|
400 |
+
|
401 |
+
if st.button('Ein fertig trainiertes Transformer-Modell von HuggingFace anwenden', key=4):
|
402 |
+
with st.spinner('Die Beurteilung der Stimmung kann einige Sekunden dauern ...'):
|
403 |
+
|
404 |
+
a5 = sentiment(string_7)
|
405 |
+
print(a5[0]['label'])
|
406 |
+
|
407 |
+
st.text('')
|
408 |
+
st.text('Verwendete Modelle:')
|
409 |
+
st.text('\nÜbersetzung:')
|
410 |
+
st.text('google/bert2bert_L-24_wmt_de_en, Authors: Sascha Rothe, Shashi Narayan, Aliaksei Severyn')
|
411 |
+
|
412 |
+
st.text('\nFrage beantworten:')
|
413 |
+
st.text('deepset/gelectra-base-germanquad, Authors: Timo Möller, Julian Risch, Malte Pietsch')
|
414 |
+
|
415 |
+
st.text('\nStimmung:')
|
416 |
+
st.text('oliverguhr/german-sentiment-bert, Authors: Oliver Guhr, Anne-Kathrin Schumann, Frank Bahrmann, Hans Joachim Böhme')
|