Spaces:
Runtime error
Runtime error
Commit
·
8767ee5
1
Parent(s):
e0b1679
Upload 2 files
Browse files- Sprachmodelle.pdf +0 -0
- app.py +25 -10
Sprachmodelle.pdf
ADDED
Binary file (541 kB). View file
|
|
app.py
CHANGED
@@ -4,7 +4,7 @@ Created on Sun Mar 26 21:07:00 2023
|
|
4 |
|
5 |
@author: Bernd Ebenhoch
|
6 |
"""
|
7 |
-
|
8 |
|
9 |
import tensorflow as tf
|
10 |
import numpy as np
|
@@ -42,10 +42,13 @@ qa_pipeline = pipeline("question-answering", model='deepset/gelectra-base-german
|
|
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", "
|
46 |
|
47 |
|
48 |
with tab1:
|
|
|
|
|
|
|
49 |
col1, col2 = tab1.columns(2)
|
50 |
size = np.array([12., 27., 32., 47., 58., 56., 58., 61.,
|
51 |
64., 67., 70., 80., 84., 88., 108.])
|
@@ -150,6 +153,10 @@ with tab1:
|
|
150 |
|
151 |
# %%
|
152 |
with tab2:
|
|
|
|
|
|
|
|
|
153 |
text_input_2 = '1: Das schöne Allgäu\n' + \
|
154 |
'1: So toll hier im Allgäu\n' + \
|
155 |
'1: Uns gefallen die Berge und Seen\n' + \
|
@@ -256,6 +263,9 @@ with tab2:
|
|
256 |
# %%
|
257 |
with tab3:
|
258 |
|
|
|
|
|
|
|
259 |
text_input = 'Das schöne Allgäu\n' + \
|
260 |
'Das wunderbare Allgäu\n' + \
|
261 |
'Das grüne Allgäu\n' + \
|
@@ -357,6 +367,7 @@ with tab3:
|
|
357 |
with tab4:
|
358 |
# st.header("Übersetzung: Deutsch --> Englisch")
|
359 |
#st.text("Übersetzung: Deutsch --> Englisch")
|
|
|
360 |
|
361 |
text_input_3 = 'Wir ünterstützen Unternehmen bei der Datenanalyse durch individuelle Beratung und Projekte mit besonderem Fokus auf maschinelles Lernen und Deep Learning.'
|
362 |
|
@@ -378,7 +389,7 @@ with tab4:
|
|
378 |
|
379 |
string_4 = st.text_area('Frage zum Kontext beantworten', value=text_input_4, height=25)
|
380 |
|
381 |
-
text_input_5 = 'Wir
|
382 |
|
383 |
string_5 = st.text_area('Kontext', value=text_input_5, height=75)
|
384 |
|
@@ -405,12 +416,16 @@ with tab4:
|
|
405 |
print(a5[0]['label'])
|
406 |
|
407 |
st.text('')
|
408 |
-
st.
|
409 |
-
|
410 |
-
st.text('
|
411 |
|
412 |
-
|
413 |
-
|
|
|
|
|
|
|
|
|
|
|
414 |
|
415 |
-
st.
|
416 |
-
st.text('oliverguhr/german-sentiment-bert, Autoren: Oliver Guhr, Anne-Kathrin Schumann, Frank Bahrmann, Hans Joachim Böhme')
|
|
|
4 |
|
5 |
@author: Bernd Ebenhoch
|
6 |
"""
|
7 |
+
|
8 |
|
9 |
import tensorflow as tf
|
10 |
import numpy as np
|
|
|
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", "HuggingFace Pipelines"])
|
46 |
|
47 |
|
48 |
with tab1:
|
49 |
+
st.markdown(
|
50 |
+
'Definieren Sie ein neuronales Netz und beobachten Sie wie sich die Kurve krümmen kann um die Daten zu fitten')
|
51 |
+
|
52 |
col1, col2 = tab1.columns(2)
|
53 |
size = np.array([12., 27., 32., 47., 58., 56., 58., 61.,
|
54 |
64., 67., 70., 80., 84., 88., 108.])
|
|
|
153 |
|
154 |
# %%
|
155 |
with tab2:
|
156 |
+
|
157 |
+
st.markdown(
|
158 |
+
'Definieren Sie Sätze, die positiv oder negativ gestimmt sind und beobachten Sie die resultieren Wort-Vektoren.')
|
159 |
+
|
160 |
text_input_2 = '1: Das schöne Allgäu\n' + \
|
161 |
'1: So toll hier im Allgäu\n' + \
|
162 |
'1: Uns gefallen die Berge und Seen\n' + \
|
|
|
263 |
# %%
|
264 |
with tab3:
|
265 |
|
266 |
+
st.markdown(
|
267 |
+
'Definieren Sie Sätze bei denen beliebige Wörter maskiert werden, um allgemeine Bezüge in Wort-Vektoren aabzubilden.')
|
268 |
+
|
269 |
text_input = 'Das schöne Allgäu\n' + \
|
270 |
'Das wunderbare Allgäu\n' + \
|
271 |
'Das grüne Allgäu\n' + \
|
|
|
367 |
with tab4:
|
368 |
# st.header("Übersetzung: Deutsch --> Englisch")
|
369 |
#st.text("Übersetzung: Deutsch --> Englisch")
|
370 |
+
st.markdown('Probieren Sie verschiedene Pipelines der Transformer-Bibliothek von HuggingFace.')
|
371 |
|
372 |
text_input_3 = 'Wir ünterstützen Unternehmen bei der Datenanalyse durch individuelle Beratung und Projekte mit besonderem Fokus auf maschinelles Lernen und Deep Learning.'
|
373 |
|
|
|
389 |
|
390 |
string_4 = st.text_area('Frage zum Kontext beantworten', value=text_input_4, height=25)
|
391 |
|
392 |
+
text_input_5 = 'Wir unterstützen Unternehmen bei der Datenanalyse durch individuelle Beratung und Projekte mit besonderem Fokus auf maschinelles Lernen und Deep Learning.'
|
393 |
|
394 |
string_5 = st.text_area('Kontext', value=text_input_5, height=75)
|
395 |
|
|
|
416 |
print(a5[0]['label'])
|
417 |
|
418 |
st.text('')
|
419 |
+
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """,
|
420 |
+
unsafe_allow_html=True)
|
421 |
+
st.text('')
|
422 |
|
423 |
+
references = 'Verwendete Modelle:\n' + \
|
424 |
+
'\nÜbersetzung:\n' + \
|
425 |
+
'google/bert2bert_L-24_wmt_de_en, Autoren: Sascha Rothe, Shashi Narayan, Aliaksei Severyn' + \
|
426 |
+
'\n\nFrage beantworten:\n' + \
|
427 |
+
'deepset/gelectra-base-germanquad, Autoren: Timo Möller, Julian Risch, Malte Pietsch' + \
|
428 |
+
'\n\nStimmung:\n' + \
|
429 |
+
'oliverguhr/german-sentiment-bert, Autoren: Oliver Guhr, Anne-Kathrin Schumann, Frank Bahrmann, Hans Joachim Böhme'
|
430 |
|
431 |
+
st.markdown(references)
|
|